Part Number Hot Search : 
STRPBF DS2506 TMS370 104M1 NJM567 SCNAR05F AP130 EA100
Product Description
Full Text Search
 

To Download ATTINY11 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 Features
* Utilizes the AVR(R) RISC Architecture * High-performance and Low-power 8-bit RISC Architecture
- 90 Powerful Instructions - Most Single Clock Cycle Execution - 32 x 8 General Purpose Working Registers - Up to 8 MIPS Throughput at 8 MHz Nonvolatile Program and Data Memory - 1K Byte of Flash Program Memory In-System Programmable (ATtiny12) Endurance: 1,000 Write/Erase Cycles (ATTINY11/12) - 64 Bytes of In-System Programmable EEPROM Data Memory for ATtiny12 Endurance: 100,000 Write/Erase Cycles - Programming Lock for Flash Program and EEPROM Data Security Peripheral Features - Interrupt and Wake-up on Pin Change - One 8-bit Timer/Counter with Separate Prescaler - On-chip Analog Comparator - Programmable Watchdog Timer with On-chip Oscillator Special Microcontroller Features - Low-power Idle and Power-down Modes - External and Internal Interrupt Sources - In-System Programmable via SPI Port (ATtiny12) - Enhanced Power-on Reset Circuit (ATtiny12) - Internal Calibrated RC Oscillator (ATtiny12) Specification - Low-power, High-speed CMOS Process Technology - Fully Static Operation Power Consumption at 4 MHz, 3V, 25C - Active: 2.2 mA - Idle Mode: 0.5 mA - Power-down Mode: <1 A Packages - 8-pin PDIP and SOIC Operating Voltages - 1.8 - 5.5V for ATtiny12V-1 - 2.7 - 5.5V for ATTINY11L-2 and ATtiny12L-4 - 4.0 - 5.5V for ATTINY11-6 and ATtiny12-8 Speed Grades - 0 - 1.2 MHz (ATtiny12V-1) - 0 - 2 MHz (ATTINY11L-2) - 0 - 4 MHz (ATtiny12L-4) - 0 - 6 MHz (ATTINY11-6) - 0 - 8 MHz (ATtiny12-8)
*
*
8-bit Microcontroller with 1K Byte Flash ATTINY11 ATtiny12
*
* *
* *
*
Pin Configuration
ATTINY11 PDIP/SOIC
(RESET) PB5 (XTAL1) PB3 (XTAL2) PB4 GND 1 2 3 4 8 7 6 5 VCC PB2 (T0) PB1 (INT0/AIN1) PB0 (AIN0) (RESET) PB5 (XTAL1) PB3 (XTAL2) PB4 GND
ATtiny12 PDIP/SOIC
1 2 3 4 8 7 6 5 VCC PB2 (SCK/T0) PB1 (MISO/INT0/AIN1) PB0 (MOSI/AIN0)
Rev. 1006D-AVR-07/03
1
Description
The ATTINY11/12 is a low-power CMOS 8-bit microcontroller based on the AVR RISC architecture. By executing powerful instructions in a single clock cycle, the ATTINY11/12 achieves throughputs approaching 1 MIPS per MHz, allowing the system designer to optimize power consumption versus processing speed. The AVR core combines a rich instruction set with 32 general-purpose working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. Table 1. Parts Description
Device ATTINY11L ATTINY11 ATtiny12V ATtiny12L ATtiny12 Flash 1K 1K 1K 1K 1K EEPROM 64 B 64 B 64 B Register 32 32 32 32 32 Voltage Range 2.7 - 5.5V 4.0 - 5.5V 1.8 - 5.5V 2.7 - 5.5V 4.0 - 5.5V Frequency 0-2 MHz 0-6 MHz 0-1.2 MHz 0-4 MHz 0-8 MHz
ATTINY11 Block Diagram
The ATTINY11 provides the following features: 1K bytes of Flash, up to five general-purpose I/O lines, one input line, 32 general-purpose working registers, an 8-bit timer/counter, internal and external interrupts, programmable Watchdog Timer with internal oscillator, and two software-selectable power-saving modes. The Idle Mode stops the CPU while allowing the timer/counters and interrupt system to continue functioning. The Power-down Mode saves the register contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. The wake-up or interrupt on pin change features enable the ATTINY11 to be highly responsive to external events, still featuring the lowest power consumption while in the power-down modes. The device is manufactured using Atmel's high-density nonvolatile memory technology. By combining an RISC 8-bit CPU with Flash on a monolithic chip, the Atmel ATTINY11 is a powerful microcontroller that provides a highly-flexible and cost-effective solution to many embedded control applications. The ATTINY11 AVR is supported with a full suite of program and system development tools including: macro assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits.
2
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 1. The ATTINY11 Block Diagram
VCC 8-BIT DATA BUS INTERNAL OSCILLATOR GND PROGRAM COUNTER STACK POINTER WATCHDOG TIMER TIMING AND CONTROL
PROGRAM FLASH
HARDWARE STACK
MCU CONTROL REGISTER
INSTRUCTION REGISTER
GENERALPURPOSE REGISTERS
MCU STATUS REGISTER
INSTRUCTION DECODER
Z
TIMER/ COUNTER
CONTROL LINES
ALU
INTERRUPT UNIT
STATUS REGISTER
PROGRAMMING LOGIC
OSCILLATORS
ANALOG COMPARATOR
DATA REGISTER PORTB
DATA DIR. REG. PORTB
+ -
PORTB DRIVERS
PB0-PB5
3
1006D-AVR-07/03
ATtiny12 Block Diagram
Figure 2. The ATtiny12 Block Diagram
VCC 8-BIT DATA BUS INTERNAL OSCILLATOR GND PROGRAM COUNTER STACK POINTER WATCHDOG TIMER INTERNAL CALIBRATED OSCILLATOR
TIMING AND CONTROL
PROGRAM FLASH
HARDWARE STACK
MCU CONTROL REGISTER
INSTRUCTION REGISTER
GENERALPURPOSE REGISTERS
MCU STATUS REGISTER
INSTRUCTION DECODER
Z
TIMER/ COUNTER
CONTROL LINES
ALU
INTERRUPT UNIT
STATUS REGISTER
EEPROM
PROGRAMMING LOGIC
SPI
OSCILLATORS
ANALOG COMPARATOR
DATA REGISTER PORTB
DATA DIR. REG. PORTB
+ -
PORTB DRIVERS
PB0-PB5
The ATtiny12 provides the following features: 1K bytes of Flash, 64 bytes EEPROM, up to six general-purpose I/O lines, 32 general-purpose working registers, an 8-bit timer/counter, internal and external interrupts, programmable Watchdog Timer with internal oscillator, and two software-selectable power-saving modes. The Idle Mode stops the CPU while allowing the timer/counters and interrupt system to continue functioning. The Power-down Mode saves the register contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. The wake-up or interrupt on pin change features enable the ATtiny12 to be highly responsive to external events, still featuring the lowest power consumption while in the power-down modes. The device is manufactured using Atmel's high-density nonvolatile memory technology. By combining an RISC 8-bit CPU with Flash on a monolithic chip, the Atmel ATtiny12 is a powerful microcontroller that provides a highly-flexible and cost-effective solution to many embedded control applications.
4
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
The ATtiny12 AVR is supported with a full suite of program and system development tools including: macro assemblers, program debugger/simulators, in-circuit emulators, and evaluation kits.
Pin Descriptions
VCC GND Port B (PB5..PB0) Supply voltage pin. Ground pin. Port B is a 6-bit I/O port. PB4..0 are I/O pins that can provide internal pull-ups (selected for each bit). On ATTINY11, PB5 is input only. On ATtiny12, PB5 is input or open-drain output. The port pins are tri-stated when a reset condition becomes active, even if the clock is not running. The use of pins PB5..3 as input or I/O pins is limited, depending on reset and clock settings, as shown below. Table 2. PB5..PB3 Functionality vs. Device Clocking Options
Device Clocking Option External Reset Enabled External Reset Disabled External Crystal External Low-frequency Crystal External Ceramic Resonator External RC Oscillator External Clock Internal RC Oscillator Notes: 1. 2. 3. 4. 5. PB5 Used
(1)
PB4 (2)
PB3 Used Used Used Used Used I/O
Input(3)/I/O(4) -
Used Used Used I/O(5) I/O I/O
"Used" means the pin is used for reset or clock purposes. "-" means the pin function is unaffected by the option. Input means the pin is a port input pin. On ATTINY11, PB5 is input only. On ATtiny12, PB5 is input or open-drain output. I/O means the pin is a port input/output pin.
XTAL1 XTAL2 RESET
Input to the inverting oscillator amplifier and input to the internal clock operating circuit. Output from the inverting oscillator amplifier. Reset input. An external reset is generated by a low level on the RESET pin. Reset pulses longer than 50 ns will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset. The device has the following clock source options, selectable by Flash fuse bits as shown: Table 3. Device Clocking Options Select
Device Clocking Option External Crystal/Ceramic Resonator External Low-frequency Crystal External RC Oscillator ATTINY11 CKSEL2..0 111 110 101 ATtiny12 CKSEL3..0 1111 - 1010 1001 - 1000 0111 - 0101
Clock Options
5
1006D-AVR-07/03
Table 3. Device Clocking Options Select (Continued)
Device Clocking Option Internal RC Oscillator External Clock ATTINY11 CKSEL2..0 100 000 ATtiny12 CKSEL3..0 0100 - 0010 0001 - 0000 -
Reserved Other Options Note: "1" means unprogrammed, "0" means programmed.
The various choices for each clocking option give different start-up times as shown in Table 7 on page 18 and Table 9 on page 20. Internal RC Oscillator The internal RC oscillator option is an on-chip oscillator running at a fixed frequency of 1 MHz in ATTINY11 and 1.2 MHz in ATtiny12. If selected, the device can operate with no external components. The device is shipped with this option selected. On ATTINY11, the Watchdog Oscillator is used as a clock, while ATtiny12 uses a separate calibrated oscillator. XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 3. Either a quartz crystal or a ceramic resonator may be used. Maximum frequency for crystal and resonators is 4 MHz. Minimum voltage for running on a low-frequency crystal is 2.5V. Figure 3. Oscillator Connections
MAX 1 HC BUFFER
HC
Crystal Oscillator
C2 C1
XTAL2 XTAL1 GND
Note:
When using the MCU Oscillator as a clock for an external device, an HC buffer should be connected as indicated in the figure.
External Clock
To drive the device from an external clock source, XTAL1 should be driven as shown in Figure 4. Figure 4. External Clock Drive Configuration
PB4 (XTAL2) EXTERNAL OSCILLATOR SIGNAL XTAL1 GND
6
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
External RC Oscillator For timing insensitive applications, the external RC configuration shown in Figure 5 can be used. For details on how to choose R and C, see Table 29 on page 59. The external RC oscillator is sensitive to noise from neighboring pins, and to avoid problems, PB5 (RESET) should be used as an output or reset pin, and PB4 should be used as an output pin. Figure 5. External RC Configuration
VCC
R
PB4 (XTAL2) XTAL1
C GND
7
1006D-AVR-07/03
Architectural Overview
The fast-access register file concept contains 32 x 8-bit general-purpose working registers with a single-clock-cycle access time. This means that during one single clock cycle, one ALU (Arithmetic Logic Unit) operation is executed. Two operands are output from the register file, the operation is executed, and the result is stored back in the register file - in one clock cycle. Two of the 32 registers can be used as a 16-bit pointer for indirect memory access. This pointer is called the Z-pointer, and can address the register file and the Flash program memory. The ALU supports arithmetic and logic functions between registers or between a constant and a register. Single-register operations are also executed in the ALU. Figure 2 shows the ATTINY11/12 AVR RISC microcontroller architecture. The AVR uses a Harvard architecture concept with separate memories and buses for program and data memories. The program memory is accessed with a two-stage pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables instructions to be executed in every clock cycle. The program memory is reprogrammable Flash memory. With the relative jump and relative call instructions, the whole 512 address space is directly accessed. All AVR instructions have a single 16-bit word format, meaning that every program memory address contains a single 16-bit instruction. During interrupts and subroutine calls, the return address program counter (PC) is stored on the stack. The stack is a 3-level-deep hardware stack dedicated for subroutines and interrupts. The I/O memory space contains 64 addresses for CPU peripheral functions as control registers, timer/counters, and other I/O functions. The memory spaces in the AVR architecture are all linear and regular memory maps.
8
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 6. The ATTINY11/12 AVR RISC Architecture
8-bit Data Bus
Program Counter Status and Test Control Registers Interrupt Unit 32 x 8 Generalpurpose Registers Direct Addressing Instruction Decoder ALU Control Lines Analog Comparator 6 I/O Lines SPI Unit (ATtiny12 only) 8-bit Timer/Counter Watchdog Timer
512 x 16 Program Flash
Instruction Register
64 x 8 EEPROM (ATtiny12 only)
A flexible interrupt module has its control registers in the I/O space with an additional global interrupt enable bit in the status register. All the different interrupts have a separ a t e i n t er r u p t v e c t o r i n t he i n t er r u p t v e c t o r t ab l e a t t he b e g i n ni n g o f t he program memory. The different interrupts have priority in accordance with their interrupt vector position. The lower the interrupt vector address, the higher the priority.
General-purpose Register File
Figure 7 shows the structure of the 32 general-purpose registers in the CPU. Figure 7. AVR CPU General-purpose Working Registers
7 R0 R1 R2 Generalpurpose Working Registers ... ... R28 R29 R30 (Z-register low byte) R31 (Z-register high byte) 0
All the register operating instructions in the instruction set have direct- and single-cycle access to all registers. The only exception is the five constant arithmetic and logic instructions SBCI, SUBI, CPI, ANDI, and ORI between a constant and a register and the LDI instruction for load-immediate constant data. These instructions apply to the second half of the registers in the register file - R16..R31. The general SBC, SUB, CP, AND,
9
1006D-AVR-07/03
OR and all other operations between two registers or on a single register apply to the entire register file. Registers 30 and 31 form a 16-bit pointer (the Z-pointer) which is used for indirect Flash memory and register file access. When the register file is accessed, the contents of R31 are discarded by the CPU.
ALU - Arithmetic Logic Unit
The high-performance AVR ALU operates in direct connection with all the 32 generalpurpose working registers. Within a single clock cycle, ALU operations between registers in the register file are executed. The ALU operations are divided into three main categories - arithmetic, logic and bit-functions. Some microcontrollers in the AVR product family feature a hardware multiplier in the arithmetic part of the ALU. The ATTINY11/12 contains 1K bytes on-chip Flash memory for program storage. Since all instructions are single 16-bit words, the Flash is organized as 512 x 16 words. The Flash memory has an endurance of at least 1000 write/erase cycles. The ATTINY11/12 Program Counter is 9 bits wide, thus addressing the 512 words Flash program memory. See page 46 for a detailed description on Flash memory programming.
Flash Program Memory
Program and Data Addressing Modes
The ATTINY11/12 AVR RISC Microcontroller supports powerful and efficient addressing modes. This section describes the different addressing modes supported in the ATTINY11/12. In the figures, OP means the operation code part of the instruction word. To simplify, not all figures show the exact location of the addressing bits. Figure 8. Direct Single-register Addressing
Register Direct, Single Register Rd
The operand is contained in register d (Rd).
10
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Register Indirect Figure 9. Indirect Register Addressing
REGISTER FILE 0
Z-register
30 31
The register accessed is the one pointed to by the Z-register (R31, R30). Register Direct, Two Registers Rd and Rr Figure 10. Direct Register Addressing, Two Registers
Operands are contained in register r (Rr) and d (Rd). The result is stored in register d (Rd). I/O Direct Figure 11. I/O Direct Addressing
Operand address is contained in 6 bits of the instruction word. n is the destination or source register address.
11
1006D-AVR-07/03
Relative Program Addressing, RJMP and RCALL
Figure 12. Relative Program Memory Addressing
+1
Program execution continues at address PC + k + 1. The relative address k is -2048 to 2047. Constant Addressing Using the LPM Instruction Figure 13. Code Memory Constant Addressing
PROGRAM MEMORY $000 15 Z-REGISTER 10
$1FF
Constant byte address is specified by the Z-register contents. The 15 MSBs select word address (0 - 511), the LSB selects low byte if cleared (LSB = 0) or high byte if set (LSB = 1).
Subroutine and Interrupt Hardware Stack
The ATTINY11/12 uses a 3-level-deep hardware stack for subroutines and interrupts. The hardware stack is 9 bits wide and stores the program counter (PC) return address while subroutines and interrupts are executed. RCALL instructions and interrupts push the PC return address onto stack level 0, and the data in the other stack levels 1-2 are pushed one level deeper in the stack. When a RET or RETI instruction is executed the returning PC is fetched from stack level 0, and the data in the other stack levels 1-2 are popped one level in the stack. If more than three subsequent subroutine calls or interrupts are executed, the first values written to the stack are overwritten. Pushing four return addresses A1, A2, A3, and A4, followed by four subroutine or interrupt returns, will pop A4, A3, A2, and once more A2 from the hardware stack.
12
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
EEPROM Data Memory
The ATtiny12 contains 64 bytes of data EEPROM memory. It is organized as a separate data space, in which single bytes can be read and written. The EEPROM has an endurance of at least 100,000 write/erase cycles. The access between the EEPROM and the CPU is described on page 38, specifying the EEPROM Address Register, the EEPROM Data Register, and the EEPROM Control Register. For SPI data downloading, see "Memory Programming" on page 46 for a detailed description.
Memory Access and Instruction Execution Timing
This section describes the general access timing concepts for instruction execution and internal memory access. The AVR CPU is driven by the System Clock O, directly generated from the external clock crystal for the chip. No internal clock division is used. Figure 14 shows the parallel instruction fetches and instruction executions enabled by the Harvard architecture and the fast-access register file concept. This is the basic pipelining concept to obtain up to 1 MIPS per MHz with the corresponding unique results for functions per cost, functions per clocks, and functions per power-unit. Figure 14. The Parallel Instruction Fetches and Instruction Executions
T1 T2 T3 T4
System Clock O 1st Instruction Fetch 1st Instruction Execute 2nd Instruction Fetch 2nd Instruction Execute 3rd Instruction Fetch 3rd Instruction Execute 4th Instruction Fetch
Figure 15 shows the internal timing concept for the register file. In a single clock cycle, an ALU operation using two register operands is executed and the result is stored back to the destination register. Figure 15. Single-cycle ALU Operation
T1 T2 T3 T4
System Clock O Total Execution Time Register Operands Fetch ALU Operation Execute Result Write Back
13
1006D-AVR-07/03
I/O Memory
The I/O space definition of the ATTINY11/12 is shown in the following table: Table 4. ATTINY11/12 I/O Space
Address Hex $3F $3B $3A $39 $38 $35 $34 $33 $32 $31 $21 $1E $1D $1C $18 $17 $16 $08 Note: Name SREG GIMSK GIFR TIMSK TIFR MCUCR MCUSR TCCR0 TCNT0 OSCCAL WDTCR EEAR EEDR EECR PORTB DDRB PINB ACSR Device ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATtiny12 ATTINY11/12 ATtiny12 ATtiny12 ATtiny12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11/12 Function Status Register General Interrupt Mask Register General Interrupt Flag Register Timer/Counter Interrupt Mask Register Timer/Counter Interrupt Flag Register MCU Control Register MCU Status Register Timer/Counter0 Control Register Timer/Counter0 (8-bit) Oscillator Calibration Register Watchdog Timer Control Register EEPROM Address Register EEPROM Data Register EEPROM Control Register Data Register, Port B Data Direction Register, Port B Input Pins, Port B Analog Comparator Control and Status Register
Reserved and unused locations are not shown in the table.
All the different ATTINY11/12 I/O and peripherals are placed in the I/O space. The different I/O locations are accessed by the IN and OUT instructions transferring data between the 32 general-purpose working registers and the I/O space. I/O registers within the address range $00 - $1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions. Refer to the Instruction Set Summary for more details. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addressed should never be written. The different I/O and peripherals control registers are explained in the following sections. Status Register - SREG The AVR status register (SREG) at I/O space location $3F is defined as:
Bit $3F Read/Write Initial Value 7 I R/W 0 6 T R/W 0 5 H R/W 0 4 S R/W 0 3 V R/W 0 2 N R/W 0 1 Z R/W 0 0 C R/W 0 SREG
* Bit 7 - I: Global Interrupt Enable The global interrupt enable bit must be set (one) for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the
14
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
global interrupt enable register is cleared (zero), none of the interrupts are enabled independent of the individual interrupt enable settings. The I-bit is cleared by hardware after an interrupt has occurred, and is set by the RETI instruction to enable subsequent interrupts. * Bit 6 - T: Bit Copy Storage The bit copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source and destination for the operated bit. A bit from a register in the register file can be copied into T by the BST instruction, and a bit in T can be copied into a bit in a register in the register file by the BLD instruction. * Bit 5 - H: Half Carry Flag The half carry flag H indicates a half-carry in some arithmetic operations. See the Instruction Set description for detailed information. * Bit 4 - S: Sign Bit, S = N V The S-bit is always an exclusive or between the negative flag N and the two's complement overflow flag V. See the Instruction Set description for detailed information. * Bit 3 - V: Two's Complement Overflow Flag The two's complement overflow flag V supports two's complement arithmetic. See the Instruction Set description for detailed information. * Bit 2 - N: Negative Flag The negative flag N indicates a negative result from an arithmetical or logical operation. See the Instruction Set description for detailed information. * Bit 1 - Z: Zero Flag The zero flag Z indicates a zero result from an arithmetical or logical operation. See the Instruction Set description for detailed information. * Bit 0 - C: Carry Flag The carry flag C indicates a carry in an arithmetical or logical operation. See the Instruction Set description for detailed information. Note that the status register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt routine. This must be handled by software.
Reset and Interrupt Handling
The ATTINY11 provides four different interrupt sources and the ATtiny12 provides five. These interrupts and the separate reset vector each have a separate program vector in the program memory space. All the interrupts are assigned individual enable bits which must be set (one) together with the I-bit in the status register in order to enable the interrupt. The lowest addresses in the program memory space are automatically defined as the Reset and Interrupt vectors. The complete list of vectors is shown in Table 5. The list also determines the priority levels of the different interrupts. The lower the address, the higher the priority level. RESET has the highest priority, and next is INT0 - the External Interrupt Request 0, etc.
15
1006D-AVR-07/03
Table 5. Reset and Interrupt Vectors
Vector No. 1 Device ATTINY11 Program Address $000 Source RESET Interrupt Definition External Pin, Power-on Reset and Watchdog Reset External Pin, Power-on Reset, Brown-out Reset and Watchdog Reset External Interrupt Request 0 Pin Change Interrupt Timer/Counter0 Overflow Analog Comparator EEPROM Ready Analog Comparator
1
ATtiny12
$000
RESET
2 3 4 5 5 6
ATTINY11/12 ATTINY11/12 ATTINY11/12 ATTINY11 ATtiny12 ATtiny12
$001 $002 $003 $004 $004 $005
INT0 I/O Pins TIMER0, OVF0 ANA_COMP EE_RDY ANA_COMP
The most typical and general program setup for the reset and interrupt vector addresses for the ATTINY11 are:
Address $000 $001 $002 $003 $004 ; $005 ... MAIN: ... ... xxx ... ; Main program start Labels Code rjmp rjmp rjmp rjmp rjmp RESET EXT_INT0 PIN_CHANGE TIM0_OVF ANA_COMP Comments ; Reset handler ; IRQ0 handler ; Pin change handler ; Timer0 overflow handler ; Analog Comparator handler
The most typical and general program setup for the reset and interrupt vector addresses for the ATtiny12 are:
Address $000 $001 $002 $003 $004 $005 ; $006 ... MAIN: ... ... xxx ... ; Main program start Labels Code rjmp rjmp rjmp rjmp rjmp rjmp RESET EXT_INT0 PIN_CHANGE TIM0_OVF EE_RDY ANA_COMP Comments ; Reset handler ; IRQ0 handler ; Pin change handler ; Timer0 overflow handler ; EEPROM Ready handler ; Analog Comparator handler
16
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Reset Sources The ATTINY11/12 provides three or four sources of reset: * * * * Power-on Reset. The MCU is reset when the supply voltage is below the power-on reset threshold (VPOT). External Reset. The MCU is reset when a low level is present on the RESET pin for more than 50 ns. Watchdog Reset. The MCU is reset when the Watchdog timer period expires and the Watchdog is enabled. Brown-out Reset. The MCU is reset when the supply voltage VCC falls below a certain voltage (ATtiny12 only).
During reset, all I/O registers are then set to their initial values, and the program starts execution from address $000. The instruction placed in address $000 must be an RJMP - relative jump - instruction to the reset handling routine. If the program never enables an interrupt source, the interrupt vectors are not used, and regular program code can be placed at these locations. The circuit diagram in Figure 16 shows the reset logic for the ATTINY11. Figure 17 shows the reset logic for the ATtiny12. Table 6 defines the electrical parameters of the reset circuitry for ATTINY11. Table 8 shows the parameters of the reset circuitry for ATtiny12. Figure 16. Reset Logic for the ATTINY11
VCC Power-on Reset Circuit POR
RESET
Reset Circuit
COUNTER RESET
S
Q
Watchdog Timer
On-chip RC Oscillator
20-stage Ripple Counter
Q3 Q9 Q13 Q19
R
Q
Table 6. Reset Characteristics for the ATTINY11
Symbol VPOT(1) VRST Note: Parameter Power-on Reset Threshold Voltage (rising) Power-on Reset Threshold Voltage (falling) RESET Pin Threshold Voltage Min 1.0 0.4 Typ 1.4 0.6 0.6 VCC Max 1.8 0.8 Units V V V
1. The Power-on Reset will not work unless the supply voltage has been below VPOT (falling).
1006D-AVR-07/03
INTERNAL RESET
FSTRT CKSEL
17
Power-on Reset for the ATTINY11
A Power-on Reset (POR) circuit ensures that the device is reset from power-on. As shown in Figure 16, an internal timer is clocked from the watchdog timer. This timer prevents the MCU from starting a certain period after V CC has reached the Power-on Threshold Voltage - VPOT. See Figure 18. The total reset period is the Delay Time-out period - tTOUT. The FSTRT fuse bit in the Flash can be programmed to give a shorter start-up time.The start-up times for the different clock options are shown in the following table. The Watchdog Oscillator is used for timing the start-up time, and this oscillator is voltage dependent as shown in the section "ATTINY11 Typical Characteristics" on page 60. Table 7. Start-up Times for the ATTINY11 (VCC = 2.7V)
Start-up Time tTOUT Selected Clock Option External Crystal External Ceramic Resonator External Low-frequency Crystal External RC Oscillator Internal RC Oscillator External Clock FSTRT Unprogrammed 67 ms 67 ms 4.2 s 4.2 ms 4.2 ms 4.2 ms FSTRT Programmed 4.2 ms 4.2 ms 4.2 s 67 s 67 s 5 clocks from reset, 2 clocks from power-down
If the built-in start-up delay is sufficient, RESET can be connected to VCC directly or via an external pull-up resistor. By holding the RESET pin low for a period after VCC has been applied, the Power-on Reset period can be extended. Refer to Figure 19 for a timing example on this.
18
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 17. Reset Logic for the ATtiny12
DATA BUS
MCU Status Register (MCUSR) PORF BORF EXTRF WDRF CKSEL[3:0] Delay Counters Full CK
Condition BOD disabled BOD enabled BOD disabled BOD enabled
Power-on Reset Circuit
BODEN BODLEVEL
Brown-out Reset Circuit
On-chip RC Oscillator
Table 8. Reset Characteristics for the ATtiny12
Symbol Parameter Power-on Reset Threshold Voltage (rising) VPOT(1) Power-on Reset Threshold Voltage (falling) VRST VBOT RESET Pin Threshold Voltage Brown-out Reset Threshold Voltage (BODLEVEL = 1) (BODLEVEL = 0) 1.5 2.3 Min 1.0 0.6 0.4 0.6 Typ 1.4 1.2 0.6 1.2 0.6VCC 1.8 2.7 1.9 V 2.8 Max 1.8 1.8 0.8 1.8 Units V V V V V
Note:
1. The Power-on Reset will not work unless the supply voltage has been below VPOT (falling).
19
1006D-AVR-07/03
Table 9. ATtiny12 Clock Options and Start-up Times
Start-up Time, VCC = 1.8V, BODLEVEL Unprogrammed 1K CK 3.6 ms + 1K CK 57 ms 1K CK 16K CK 3.6 ms + 16K CK 57 ms + 16K CK 57 ms + 1K CK 57 ms + 32K CK 6 CK 3.6 ms + 6 CK 57 ms + 6 CK 6 CK 3.6 ms + 6 CK 57 ms + 6 CK 6 CK 3.6 ms + 6 CK Start-up Time, VCC = 2.7V, BODLEVEL Programmed 1K CK 4.2 ms + 1K CK 67 ms + 1K CK 16K CK 4.2 ms + 16K CK 67 ms + 16K CK 67 ms + 1K CK 67 ms + 32K CK 6 CK 4.2 ms + 6 CK 67 ms + 6 CK 6 CK 4.2 ms + 6 CK 67 ms + 6 CK 6 CK 4.2 ms + 6 CK
CKSEL3..0 1111 1110 1101 1100 1011 1010 1001 1000 0111 0110 0101 0100 0011 0010 0001 0000 Note:
Clock Source Ext. Crystal/Ceramic Resonator(1) Ext. Crystal/Ceramic Resonator(1) Ext. Crystal/Ceramic Resonator
(1)
Ext. Crystal/Ceramic Resonator Ext. Crystal/Ceramic Resonator Ext. Crystal/Ceramic Resonator Ext. Low-frequency Crystal Ext. Low-frequency Crystal Ext. RC Oscillator Ext. RC Oscillator Ext. RC Oscillator Int. RC Oscillator Int. RC Oscillator Int. RC Oscillator Ext. Clock Ext. Clock
1. Due to the limited number of clock cycles in the start-up period, it is recommended that Ceramic Resonator be used.
This table shows the start-up times from reset. From sleep, only the clock counting part of the start-up time is used. The Watchdog oscillator is used for timing the real-time part of the start-up time. The number of WDT oscillator cycles used for each time-out is shown in Table 10. Table 10. Number of Watchdog Oscillator Cycles
BODLEVEL Unprogrammed Unprogrammed Programmed Programmed Time-out 3.6 ms (at Vcc = 1.8V) 57 ms (at Vcc = 1.8V) 4.2 ms (at Vcc = 2.7V) 67 ms (at Vcc = 2.7V) Number of Cycles 256 4K 1K 16K
The frequency of the watchdog oscillator is voltage dependent as shown in the section "ATTINY11 Typical Characteristics" on page 60. Note that the BODLEVEL fuse can be used to select start-up times even if the Brownout Detection is disabled (by leaving the BODEN fuse unprogrammed). The device is shipped with CKSEL3..0 = 0010.
20
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Power-on Reset for the ATtiny12 A Power-on Reset (POR) pulse is generated by an on-chip detection circuit. The detection level is nominally 1.4V. The POR is activated whenever VCC is below the detection level. The POR circuit can be used to trigger the start-up reset, as well as detect a failure in supply voltage. The Power-on Reset (POR) circuit ensures that the device is reset from power-on. Reaching the Power-on Reset threshold voltage invokes a delay counter, which determines the delay for which the device is kept in Reset after VCC rise. The time-out period of the delay counter can be defined by the user through the CKSEL fuses. The different selections for the delay period are presented in Table 9. The Reset signal is activated again, without any delay, when the VCC decreases below detection level. If the built-in start-up delay is sufficient, RESET can be connected to VCC directly or via an external pull-up resistor. See Figure 18. By holding the RESET pin low for a period after VCC has been applied, the Power-on Reset period can be extended. Refer to Figure 19 for a timing example on this. Figure 18. MCU Start-up, RESET Tied to VCC.
VCC VPOT
RESET
VRST
TIME-OUT
tTOUT
INTERNAL RESET
Figure 19. MCU Start-up, RESET Extended Externally
VCC VPOT
RESET
VRST
tTOUT TIME-OUT
INTERNAL RESET
External Reset
An external reset is generated by a low level on the RESET pin. Reset pulses longer than 50 ns will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset. When the applied signal reaches the Reset Threshold Voltage - VRST - on its positive edge, the delay timer starts the MCU after the Time-out period (tTOUT) has expired.
21
1006D-AVR-07/03
Figure 20. External Reset during Operation
VCC
RESET
VRST
t TOUT
TIME-OUT
INTERNAL RESET
Brown-out Detection (ATtiny12)
ATtiny12 has an on-chip brown-out detection (BOD) circuit for monitoring the VCC level during the operation. The BOD circuit can be enabled/disabled by the fuse BODEN. When BODEN is enabled (BODEN programmed), and VCC decreases below the trigger level, the brown-out reset is immediately activated. When VCC increases above the trigger level, the brown-out reset is deactivated after a delay. The delay is defined by the user in the same way as the delay of POR signal, in Table 5. The trigger level for the BOD can be selected by the fuse BODLEVEL to be 1.8V (BODLEVEL unprogrammed), or 2.7V (BODLEVEL programmed). The trigger level has a hysteresis of 50 mV to ensure spike-free brown-out detection. The BOD circuit will only detect a drop in VCC if the voltage stays below the trigger level for longer than 7 s for trigger level 2.7V, 24 s for trigger level 1.8V (typical values). Figure 21. Brown-out Reset during Operation (ATtiny12)
VCC VBOT+
VBOT-
RESET
TIME-OUT
tTOUT
INTERNAL RESET
Note: The hysteresis on VBOT: VBOT + = VBOT + 25 mV, VBOT- = VBOT - 25 mV.
22
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Watchdog Reset When the Watchdog times out, it will generate a short reset pulse of 1 CK cycle duration. On the falling edge of this pulse, the delay timer starts counting the Time-out period (tTOUT). Refer to page 36 for details on operation of the Watchdog. Figure 22. Watchdog Reset during Operation
VCC
CK
MCU Status Register - MCUSR of the ATTINY11
The MCU Status Register provides information on which reset source caused an MCU reset.
Bit $34 Read/Write Initial Value 7 R 0 6 R 0 5 R 0 4 R 0 3 R 0 2 R 0 1 EXTRF R/W 0 PORF R/W MCUSR
See bit description
* Bit 7..2 - Res: Reserved Bits These bits are reserved bits in the ATTINY11 and always read as zero. * Bit 1 - EXTRF: EXTernal Reset Flag After a power-on reset, this bit is undefined (X). It will be set by an external reset. A watchdog reset will leave this bit unchanged. * Bit 0 - PORF: Power-on Reset Flag This bit is set by a power-on reset. A watchdog reset or an external reset will leave this bit unchanged. To summarize, the following table shows the value of these two bits after the three modes of reset. Table 11. PORF and EXTRF Values after Reset
Reset Source Power-on External Reset Watchdog Reset EXTRF Undefined 1 Unchanged PORF 1 Unchanged Unchanged
To identify a reset condition, the user software should clear both the PORF and EXTRF bits as early as possible in the program. Checking the PORF and EXTRF values is done
23
1006D-AVR-07/03
before the bits are cleared. If the bit is cleared before an external or watchdog reset occurs, the source of reset can be found by using the following truth table: Table 12. Reset Source Identification
EXTRF 0 1 0 1 PORF 0 0 1 1 Reset Source Watchdog Reset External Reset Power-on Reset Power-on Reset
MCU Status Register - MCUSR for the ATtiny12
The MCU Status Register provides information on which reset source caused an MCU reset.
Bit $34 Read/Write Initial Value 7 R 0 6 R 0 5 R 0 4 R 0 3 WDRF R/W 2 BORF R/W 1 EXTRF R/W 0 PORF R/W MCUSR
See Bit Description
* Bit 7..4 - Res: Reserved Bits These bits are reserved bits in the ATtiny12 and always read as zero. * Bit 3 - WDRF: Watchdog Reset Flag This bit is set if a watchdog reset occurs. The bit is reset by a power-on reset, or by writing a logic zero to the flag. * Bit 2 - BORF: Brown-out Reset Flag This bit is set if a brown-out reset occurs. The bit is reset by a power-on reset, or by writing a logic zero to the flag. * Bit 1 - EXTRF: EXTernal Reset Flag This bit is set if an external reset occurs. The bit is reset by a power-on reset, or by writing a logic zero to the flag. * Bit 0 - PORF: Power-on Reset Flag This bit is set if a power-on reset occurs. The bit is reset by writing a logic zero to the flag. To use the reset flags to identify a reset condition, the user should read and then reset the MCUSR as early as possible in the program. If the register is cleared before another reset occurs, the source of the reset can be found by examining the reset flags.
ATtiny12 Internal Voltage Reference
Voltage Reference Enable Signals and Start-up Time
ATtiny12 features an internal voltage reference with a nominal voltage of 1.22V. This reference is used for Brown-out Detection, and it can be used as an input to the Analog Comparator. The voltage reference has a start-up time that may influence the way it should be used. The maximum start-up time is 10s. To save power, the reference is not always turned on. The reference is on during the following situations:
24
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
1. When BOD is enabled (by programming the BODEN fuse) 2. When the bandgap reference is connected to the Analog Comparator (by setting the AINBG bit in ACSR) Thus, when BOD is not enabled, after setting the AINBG bit, the user must always allow the reference to start up before the output from the Analog Comparator is used. The bandgap reference uses approximately 10 A, and to reduce power consumption in Power-down mode, the user can turn off the reference when entering this mode.
Interrupt Handling
The ATTINY11/12 has two 8-bit Interrupt Mask control registers; GIMSK - General Interrupt Mask register and TIMSK - Timer/Counter Interrupt Mask register. When an interrupt occurs, the Global Interrupt Enable I-bit is cleared (zero) and all interrupts are disabled. The user software can set (one) the I-bit to enable nested interrupts. The I-bit is set (one) when a Return from Interrupt instruction - RETI - is executed. When the Program Counter is vectored to the actual interrupt vector in order to execute the interrupt handling routine, hardware clears the corresponding flag that generated the interrupt. Some of the interrupt flags can also be cleared by writing a logic one to the flag bit position(s) to be cleared. If an interrupt condition occurs when the corresponding interrupt enable bit is cleared (zero), the interrupt flag will be set and remembered until the interrupt is enabled, or the flag is cleared by software. If one or more interrupt conditions occur when the global interrupt enable bit is cleared (zero), the corresponding interrupt flag(s) will be set and remembered until the global interrupt enable bit is set (one), and will be executed by order of priority. Note that external level interrupt does not have a flag, and will only be remembered for as long as the interrupt condition is active. Note that the status register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt routine. This must be handled by software.
Interrupt Response Time
The interrupt execution response for all the enabled AVR interrupts is 4 clock cycles minimum. After the 4 clock cycles, the program vector address for the actual interrupt handling routine is executed. During this 4-clock-cycle period, the Program Counter (9 bits) is pushed onto the Stack. The vector is normally a relative jump to the interrupt routine, and this jump takes 2 clock cycles. If an interrupt occurs during execution of a multi-cycle instruction, this instruction is completed before the interrupt is served. In ATtiny12, if an interrupt occurs when the MCU is in Sleep mode, the interrupt response time is increased by 4 clock cycles. A return from an interrupt handling routine takes 4 clock cycles. During these 4 clock cycles, the Program Counter (9 bits) is popped back from the Stack, and the I-flag in SREG is set. When AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served.
General Interrupt Mask Register - GIMSK
Bit $3B Read/Write Initial Value
7 R 0
6 INT0 R/W 0
5 PCIE R/W 0
4 R 0
3 R 0
2 R 0
1 R 0
0 R 0 GIMSK
25
1006D-AVR-07/03
* Bit 7 - Res: Reserved Bit This bit is a reserved bit in the ATTINY11/12 and always reads as zero. * Bit 6 - INT0: External Interrupt Request 0 Enable When the INT0 bit is set (one) and the I-bit in the Status Register (SREG) is set (one), the external pin interrupt is enabled. The Interrupt Sense Control0 bits 1/0 (ISC01 and ISC00) in the MCU general Control Register (MCUCR) define whether the external interrupt is activated on rising or falling edge, on pin change, or low level of the INT0 pin. Activity on the pin will cause an interrupt request even if INT0 is configured as an output. The corresponding interrupt of External Interrupt Request 0 is executed from program memory address $001. See also "External Interrupts." * Bit 5 - PCIE: Pin Change Interrupt Enable When the PCIE bit is set (one) and the I-bit in the Status Register (SREG) is set (one), the interrupt on pin change is enabled. Any change on any input or I/O pin will cause an interrupt. The corresponding interrupt of Pin Change Interrupt Request is executed from program memory address $002. See also "Pin Change Interrupt." * Bits 4..0 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and always read as zero. General Interrupt Flag Register - GIFR
Bit $3A Read/Write Initial Value
7 R 0
6 INTF0 R/W 0
5 PCIF R/W 0
4 R 0
3 R 0
2 R 0
1 R 0
0 R 0 GIFR
* Bit 7 - Res: Reserved Bit This bit is a reserved bit in the ATTINY11/12 and always reads as zero. * Bit 6 - INTF0: External Interrupt Flag0 When an edge on the INT0 pin triggers an interrupt request, the corresponding interrupt flag, INTF0 becomes set (one). If the I-bit in SREG and the corresponding interrupt enable bit, INT0 bit in GIMSK, are set (one), the MCU will jump to the interrupt vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. The flag is always cleared when INT0 is configured as level interrupt. * Bit 5 - PCIF: Pin Change Interrupt Flag When an event on any input or I/O pin triggers an interrupt request, PCIF becomes set (one). If the I-bit in SREG and the PCIE bit in GIMSK are set (one), the MCU will jump to the interrupt vector at address $002. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. * Bits 4..0 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and always read as zero. Timer/Counter Interrupt Mask Register - TIMSK
Bit
7
6
5
4
3
2
1
0
26
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
$39 Read/Write Initial Value R 0 R 0 R 0 R 0 R 0 R 0 TOIE0 R/W 0 R 0 TIMSK
* Bit 7..2 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and always read as zero. * Bit 1 - TOIE0: Timer/Counter0 Overflow Interrupt Enable When the TOIE0 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter0 Overflow interrupt is enabled. The corresponding interrupt (at vector $003) is executed if an overflow in Timer/Counter0 occurs, i.e., when the Overflow Flag (Timer0) is set (one) in the Timer/Counter Interrupt Flag Register - TIFR. * Bit 0 - Res: Reserved Bit This bit is a reserved bit in the ATTINY11/12 and always reads as zero. Timer/Counter Interrupt Flag Register - TIFR
Bit $38 Read/Write Initial Value
7 R 0
6 R 0
5 R 0
4 R 0
3 R 0
2 R 0
1 TOV0 R/W 0
0 R 0 TIFR
* Bits 7..2 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and always read as zero. * Bit 1 - TOV0: Timer/Counter0 Overflow Flag The bit TOV0 is set (one) when an overflow occurs in Timer/Counter0. TOV0 is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, TOV0 is cleared by writing a logical one to the flag. When the SREG I-bit, TOIE0 (Tim er /Counter0 Overf low Interrupt Enabl e), and TO V0 are set (one), the Timer/Counter0 Overflow interrupt is executed. * Bit 0 - Res: Reserved bit This bit is a reserved bit in the ATTINY11/12 and always reads as zero. External Interrupt The external interrupt is triggered by the INT0 pin. Observe that, if enabled, the interrupt will trigger even if the INT0 pin is configured as an output. This feature provides a way of generating a software interrupt. The external interrupt can be triggered by a falling or rising edge, a pin change, or a low level. This is set up as indicated in the specification for the MCU Control Register - MCUCR. When the external interrupt is enabled and is configured as level triggered, the interrupt will trigger as long as the pin is held low. The external interrupt is set up as described in the specification for the MCU Control Register - MCUCR. Pin Change Interrupt The pin change interrupt is triggered by any change on any input or I/O pin. Change on pins PB2..0 will always cause an interrupt. Change on pins PB5..3 will cause an interrupt if the pin is configured as input or I/O, as described in the section "Pin Descriptions" on page 5. Observe that, if enabled, the interrupt will trigger even if the changing pin is configured as an output. This feature provides a way of generating a software interrupt. Also observe that the pin change interrupt will trigger even if the pin activity triggers
27
1006D-AVR-07/03
another interrupt, for example, the external interrupt. This implies that one external event might cause several interrupts. The values on the pins are sampled before detecting edges. If pin change interrupt is enabled, pulses that last longer than one CPU clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt.
28
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
MCU Control Register - MCUCR The MCU Control Register contains control bits for general MCU functions.
Bit $35 Read/Write Initial Value 7 R 0 6 (PUD) R(/W) 0 5 SE R/W 0 4 SM R/W 0 3 R 0 2 R 0 1 ISC01 R/W 0 0 ISC00 R/W 0 MCUCR
Note:
The Pull-up Disable (PUD) bit is only available in ATtiny12.
* Bit 7 - Res: Reserved Bit This bit is a reserved bit in the ATTINY11/12 and always reads as zero. * Bit 6 - Res: Reserved Bit in ATTINY11 This bit is a reserved bit in the ATTINY11 and always reads as zero. * Bit 6 - PUD: Pull-up Disable in ATtiny12 Setting this bit, disables all pull-ups on port B. If this bit is cleared, the pull-ups can be individually enabled as described in section "I/O Port B" on page 43. * Bit 5 - SE: Sleep Enable The SE bit must be set (one) to make the MCU enter the Sleep Mode when the SLEEP instruction is executed. To avoid the MCU entering the Sleep Mode unless it is the programmer's purpose, it is recommended to set the Sleep Enable SE bit just before the execution of the SLEEP instruction. * Bit 4 - SM: Sleep Mode This bit selects between the two available sleep modes. When SM is cleared (zero), Idle Mode is selected as Sleep Mode. When SM is set (one), Power-down Mode is selected as Sleep Mode. For details, refer to the paragraph "Sleep Modes" below. * Bits 3, 2 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and always read as zero. * Bits 1, 0 - ISC01, ISC00: Interrupt Sense Control0 Bit 1 and Bit 0 The External Interrupt 0 is activated by the external pin INT0 if the SREG I-flag and the corresponding interrupt mask are set. The following table shows how to set the ISC bits to generate an external interrupt: Table 13. Interrupt 0 Sense Control
ISC01 0 0 1 1 ISC00 0 1 0 1 Description The low level of INT0 generates an interrupt request. Any change on INT0 generates an interrupt request The falling edge of INT0 generates an interrupt request. The rising edge of INT0 generates an interrupt request.
The value on the INT0 pin is sampled before detecting edges. If edge interrupt is selected, pulses that last longer than one CPU clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. If low-level interrupt is selected, the low level must be held until the completion of the currently executing
29
1006D-AVR-07/03
instruction to generate an interrupt. If enabled, a level-triggered interrupt will generate an interrupt request as long as the pin is held low.
30
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Sleep Modes for the ATTINY11
To enter the sleep modes, the SE bit in MCUCR must be set (one) and a SLEEP instruction must be executed. The SM bit in the MCUCR register selects which sleep mode (Idle or Power-down) will be activated by the SLEEP instruction. If an enabled interrupt occurs while the MCU is in a sleep mode, the MCU awakes, executes the interrupt routine, and resumes execution from the instruction following SLEEP. On wake-up from Power Down Mode on pin change, two instruction cycles are executed before the pin change interrupt flag is updated. During these cycles, the prosessor executes intructions, but the interrupt condition is not readable, and the interrupt routine has not startet yet. The contents of the register file and I/O memory are unaltered. If a reset occurs during Sleep Mode, the MCU wakes up and executes from the Reset vector. When the SM bit is cleared (zero), the SLEEP instruction forces the MCU into the Idle Mode, stopping the CPU but allowing Timer/Counters, Watchdog and the interrupt system to continue operating. This enables the MCU to wake up from external triggered interrupts as well as internal ones like Timer Overflow interrupt and Watchdog Reset. If wake-up from the Analog Comparator interrupt is not required, the analog comparator can be powered down by setting the ACD-bit in the Analog Comparator Control and Status register - ACSR. This will reduce power consumption in Idle Mode. When the MCU wakes up from Idle mode, the CPU starts program execution immediately. When the SM bit is set (one), the SLEEP instruction forces the MCU into the Powerdown Mode. In this mode, the external oscillator is stopped, while the external interrupts and the Watchdog (if enabled) continue operating. Only an external reset, a watchdog reset (if enabled), an external level interrupt, or an pin change interrupt can wake up the MCU. Note that if a level-triggered or pin change interrupt is used for wake-up from powerdown, the changed level must be held for a time longer than the reset delay period of tTOUT. Otherwise, the MCU will fail to wake up.
Idle Mode
Power-down Mode
Sleep Modes for the ATtiny12
To enter the sleep modes, the SE bit in MCUCR must be set (one) and a SLEEP instruction must be executed. The SM bit in the MCUCR register selects which sleep mode (Idle or Power-down) will be activated by the SLEEP instruction. If an enabled interrupt occurs while the MCU is in a sleep mode, the MCU awakes. The CPU is then halted for four cycles, it executes the interrupt routine, and resumes execution from the instruction following SLEEP. The contents of the register file and I/O memory are unaltered. If a reset occurs during sleep mode, the MCU wakes up and executes from the Reset vector. When the SM bit is cleared (zero), the SLEEP instruction forces the MCU into the Idle Mode stopping the CPU but allowing Timer/Counters, Watchdog and the interrupt system to continue operating. This enables the MCU to wake up from external triggered interrupts as well as internal ones like Timer Overflow interrupt and Watchdog Reset. If wake-up from the Analog Comparator interrupt is not required, the analog comparator can be powered down by setting the ACD-bit in the Analog Comparator Control and Status Register - ACSR. This will reduce power consumption in Idle Mode. When the SM bit is set (one), the SLEEP instruction forces the MCU into the Powerdown Mode. In this mode, the external oscillator is stopped, while the external interrupts and the Watchdog (if enabled) continue operating. Only an external reset, a watchdog reset (if enabled), an external level interrupt, or a pin change interrupt can wake up the MCU.
Idle Mode
Power-down Mode
31
1006D-AVR-07/03
Note that if a level triggered or pin change interrupt is used for wake-up from Powerdown Mode, the changed level must be held for a time to wake up the MCU. This makes the MCU less sensitive to noise. The wake-up period is equal to the clock-counting part of the reset period (See Table 9). The MCU will wake up from the power-down if the input has the required level for two watchdog oscillator cycles. If the wake-up period is shorter than two watchdog oscillator cycles, the MCU will wake up if the input has the required level for the duration of the wake-up period. If the wake-up condition disappears before the wake-up period has expired, the MCU will wake up from power-down without executing the corresponding interrupt. The period of the watchdog oscillator is 2.7 s (nominal) at 3.0V and 25C. The frequency of the watchdog oscillator is voltage dependent as shown in the section "ATTINY11 Typical Characteristics" on page 60. When waking up from Power-down Mode, there is a delay from the wake-up condition occurs until the wake-up becomes effective. This allows the clock to restart and become stable after having been stopped. The wake-up period is defined by the same CKSEL fuses that define the reset time-out period.
ATtiny12 Calibrated Internal RC Oscillator
In ATtiny12, the calibrated internal oscillator provides a fixed 1.2 MHz (nominal) clock at 5V and 25C. This clock may be used as the system clock. See the section "Clock Options" on page 5 for information on how to select this clock as the system clock. This oscillator can be calibrated by writing the calibration byte to the OSCCAL register. When this oscillator is used as the chip clock, the Watchdog Oscillator will still be used for the Watchdog Timer and for the reset time-out. For details on how to use the pre-programmed calibration value, see the section "Calibration Byte in ATtiny12" on page 47. At 5V and 25oC, the pre-programmed calibration byte gives a frequency within 1% of the nominal frequency.
Oscillator Calibration Register - OSCCAL
Bit $31 Read/Write Initial Value
7 CAL7 R/W 0
6 CAL6 R/W 0
5 CAL5 R/W 0
4 CAL4 R/W 0
3 CAL3 R/W 0
2 CAL2 R/W 0
1 CAL1 R/W 0
0 CAL0 R/W 0 OSCCAL
* Bits 7..0 - CAL7..0: Oscillator Calibration Value Writing the calibration byte to this address will trim the internal oscillator to remove process variations from the oscillator frequency. When OSCCAL is zero, the lowest available frequency is chosen. Writing non-zero values to this register will increase the frequency of the internal oscillator. Writing $FF to the register gives the highest available frequency. The calibrated oscillator is used to time EEPROM access. If EEPROM is written, do not calibrate to more than 10% above the nominal frequency. Otherwise, the EEPROM write may fail. Table 14 shows the range for OSCCAL. Note that the oscillator is intended for calibration to 1.2 MHz, thus tuning to other values is not guaranteed. Table 14. Internal RC Oscillator Frequency Range
OSCCAL Value $00 $7F $FF Min Frequency 0.6 MHz 0.8 MHz 1.2 MHz Max Frequency 1.2 MHz 1.7 MHz 2.5 MHz
32
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Timer/Counter0
The ATTINY11/12 provides one general-purpose 8-bit Timer/Counter - Timer/Counter0. The Timer/Counter0 has prescaling selection from the 10-bit prescaling timer. The Timer/Counter0 can either be used as a timer with an internal clock timebase or as a counter with an external pin connection that triggers the counting. Figure 23 shows the Timer/Counter prescaler. Figure 23. Timer/Counter0 Prescaler
CK
CK/8
Timer/Counter Prescaler
10-BIT T/C PRESCALER
CK/64 CK/256 CK/1024
T0 0
CS00 CS01 CS02
TIMER/COUNTER0 CLOCK SOURCE TCK0
The four different prescaled selections are: CK/8, CK/64, CK/256 and CK/1024 where CK is the oscillator clock. CK, external source and stop, can also be selected as clock sources. Figure 24 shows the block diagram for Timer/Counter0. The 8-bit Timer/Counter0 can select clock source from CK, prescaled CK, or an external pin. In addition, it can be stopped as described in the specification for the Timer/Counter0 Control Register - TCCR0. The overflow status flag is found in the Timer/Counter Interrupt Flag Register - TIFR. Control signals are found in the Timer/Counter0 Control Register - TCCR0. The interrupt enable/disable settings for Timer/Counter0 are found in the Timer/Counter Interrupt Mask Register - TIMSK. When Timer/Counter0 is externally clocked, the external signal is synchronized with the oscillator frequency of the CPU. To ensure proper sampling of the external clock, the minimum time between two external clock transitions must be at least one internal CPU clock period. The external clock signal is sampled on the rising edge of the internal CPU clock. The 8-bit Timer/Counter0 features both a high-resolution and a high-accuracy usage with the lower prescaling opportunities. Similarly, the high-prescaling opportunities make the Timer/Counter0 useful for lower-speed functions or exact-timing functions with infrequent actions.
33
1006D-AVR-07/03
Figure 24. Timer/Counter0 Block Diagram
T0
Timer/Counter0 Control Register - TCCR0
Bit $33 Read/Write Initial Value
7 R 0
6 R 0
5 R 0
4 R 0
3 R 0
2 CS02 R/W 0
1 CS01 R/W 0
0 CS00 R/W 0 TCCR0
* Bits 7..3 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and always read as zero. * Bits 2,1,0 - CS02, CS01, CS00: Clock Select0, Bit 2,1 and 0 The Clock Select0 bits 2,1 and 0 define the prescaling source of Timer0. Table 15. Clock 0 Prescale Select
CS02 0 0 0 0 1 1 1 1 CS01 0 0 1 1 0 0 1 1 CS00 0 1 0 1 0 1 0 1 Description Stop, the Timer/Counter0 is stopped. CK CK/8 CK/64 CK/256 CK/1024 External Pin T0, falling edge External Pin T0, rising edge
34
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
The Stop condition provides a Timer Enable/Disable function. The CK down-divided modes are scaled directly from the CK oscillator clock. If the external pin modes are used for Timer/Counter0, transitions on PB2/(T0) will clock the counter even if the pin is configured as an output. This feature can give the user SW control of the counting. Timer Counter 0 - TCNT0
Bit $32 Read/Write Initial Value 7 MSB R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 R/W 0 6 5 4 3 2 1 0 LSB R/W 0 TCNT0
The Timer/Counter0 is implemented as an up-counter with read and write access. If the Timer/Counter0 is written and a clock source is present, the Timer/Counter0 continues counting in the timer clock cycle following the write operation.
35
1006D-AVR-07/03
Watchdog Timer
The Watchdog Timer is clocked from a separate on-chip oscillator. By controlling the Watchdog Timer prescaler, the Watchdog reset interval can be adjusted as shown in Table 16. See characterization data for typical values at other VCC levels. The WDR - Watchdog Reset - instruction resets the Watchdog Timer. Eight different clock cycle periods can be selected to determine the reset period. If the reset period expires without another Watchdog reset, the ATTINY11/12 resets and executes from the reset vector. For timing details on the Watchdog reset, refer to page 23. To prevent unintentional disabling of the watchdog, a special turn-off sequence must be followed when the watchdog is disabled. Refer to the description of the Watchdog Timer Control Register for details. Figure 25. Watchdog Timer
Oscillator 1 MHz at VCC = 5V 350 kHz at VCC = 3V 110 kHz at VCC = 2V
Watchdog Timer Control Register - WDTCR
Bit $21 Read/Write Initial Value
7
-
6
-
5
-
4
WDTOE
3
WDE
2
WDP2
1
WDP1
0
WDP0 WDTCR
R 0
R 0
R 0
R/W 0
R/W 0
R/W 0
R/W 0
R/W 0
* Bits 7..5 - Res: Reserved Bits These bits are reserved bits in the ATTINY11/12 and will always read as zero. * Bit 4 - WDTOE: Watchdog Turn-off Enable This bit must be set (one) when the WDE bit is cleared. Otherwise, the watchdog will not be disabled. Once set, hardware will clear this bit to zero after four clock cycles. Refer to the description of the WDE bit for a watchdog disable procedure. * Bit 3 - WDE: Watchdog Enable When the WDE is set (one) the Watchdog Timer is enabled, and if the WDE is cleared (zero) the Watchdog Timer function is disabled. WDE can be cleared only when the WDTOE bit is set(one). To disable an enabled watchdog timer, the following procedure must be followed:
36
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
1. In the same operation, write a logical one to WDTOE and WDE. A logical one must be written to WDE even though it is set to one before the disable operation starts. 2. Within the next four clock cycles, write a logical 0 to WDE. This disables the watchdog. * Bits 2..0 - WDP2, WDP1, WDP0: Watchdog Timer Prescaler 2, 1 and 0 The WDP2, WDP1 and WDP0 bits determine the Watchdog Timer prescaling when the Watchdog Timer is enabled. The different prescaling values and their corresponding time-out periods are shown in Table 16. Table 16. Watchdog Timer Prescale Select
Number of WDT Oscillator cycles 16K cycles 32K cycles 64K cycles 128K cycles 256K cycles 512K cycles 1,024K cycles 2,048K cycles Typical Time-out at VCC = 2.0V 0.15s 0.30s 0.60s 1.2s 2.4s 4.8s 9.6s 19s Typical Time-out at VCC = 3.0V 47 ms 94 ms 0.19 s 0.38 s 0.75 s 1.5 s 3.0 s 6.0 s Typical Time-out at VCC = 5.0V 15 ms 30 ms 60 ms 0.12 s 0.24 s 0.49 s 0.97 s 1.9 s
WDP2 0 0 0 0 1 1 1 1 Note:
WDP1 0 0 1 1 0 0 1 1
WDP0 0 1 0 1 0 1 0 1
The frequency of the Watchdog Oscillator is voltage dependent as shown in the section "ATTINY11 Typical Characteristics" on page 60. The WDR - Watchdog Reset - instruction should always be executed before the Watchdog Timer is enabled. This ensures that the reset period will be in accordance with the Watchdog Timer prescale settings. If the Watchdog Timer is enabled without reset, the Watchdog Timer may not start counting from zero. To avoid unintentional MCU resets, the Watchdog Timer should be disabled or reset before changing the Watchdog Timer Prescale Select.
37
1006D-AVR-07/03
ATtiny12 EEPROM Read/Write Access
The EEPROM access registers are accessible in the I/O space. The write access time is in the range of 3.1 - 6.8 ms, depending on the frequency of the calibrated RC oscillator. See Table 17 for details. A self-timing function lets the user software detect when the next byte can be written. A special EEPROM Ready interrupt can be set to trigger when the EEPROM is ready to accept new data. The minimum voltage for writing to the EEPROM is 2.2V. In order to prevent unintentional EEPROM writes, a two-state write procedure must be followed. Refer to the description of the EEPROM Control Register for details on this. When the EEPROM is written, the CPU is halted for two clock cycles before the next instruction is executed. When the EEPROM is read, the CPU is halted for four clock cycles before the next instruction is executed.
EEPROM Address Register - EEAR
Bit $1E
7 -
6 -
5 EEAR5
4 EEAR4
3 EEAR3
2 EEAR2
1 EEAR1
0 EEAR0 EEAR
Read/Write Initial Value
R 0
R 0
R/W X
R/W X
R/W X
R/W X
R/W X
R/W X
The EEPROM Address Register - EEAR specifies the EEPROM address in the 64-byte EEPROM space. The EEPROM data bytes are addressed linearly between 0 and 63. During reset, the EEAR register is not cleared. Instead, the data in the register is kept. EEPROM Data Register - EEDR
Bit $1D Read/Write Initial Value
7 MSB R/W 0
6
5
4
3
2
1
0 LSB EEDR
R/W 0
R/W 0
R/W 0
R/W 0
R/W 0
R/W 0
R/W 0
* Bits 7..0 - EEDR7.0: EEPROM Data For the EEPROM write operation, the EEDR register contains the data to be written to the EEPROM in the address given by the EEAR register. For the EEPROM read operation, the EEDR contains the data read out from the EEPROM at the address given by EEAR. EEPROM Control Register - EECR
Bit $1C Read/Write Initial Value
7 R 0
6 R 0
5 R 0
4 R 0
3 EERIE R/W 0
2 EEMWE R/W 0
1 EEWE R/W X
0 EERE R/W 0 EECR
* Bit 7..4 - Res: Reserved Bits These bits are reserved bits in the ATtiny12 and will always read as zero. * Bit 3 - EERIE: EEPROM Ready Interrupt Enable When the I-bit in SREG and EERIE are set (one), the EEPROM Ready interrupt is enabled. When cleared (zero), the interrupt is disabled. The EEPROM Ready interrupt generates a constant interrupt when EEWE is cleared (zero).
38
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
* Bit 2 - EEMWE: EEPROM Master Write Enable The EEMWE bit determines whether setting EEWE to one causes the EEPROM to be written. When EEMWE is set (one), setting EEWE will write data to the EEPROM at the selected address. If EEMWE is zero, setting EEWE will have no effect. When EEMWE has been set (one) by software, hardware clears the bit to zero after four clock cycles. See the description of the EEWE bit for a EEPROM write procedure. * Bit 1 - EEWE: EEPROM Write Enable The EEPROM Write Enable Signal EEWE is the write strobe to the EEPROM. When address and data are correctly set up, the EEWE bit must be set to write the value into the EEPROM. The EEMWE bit must be set when the logical one is written to EEWE, otherwise no EEPROM write takes place. The following procedure should be followed when writing the EEPROM (the order of steps 2 and 3 is unessential): 1. Wait until EEWE becomes zero. 2. Write new EEPROM address to EEAR (optional). 3. Write new EEPROM data to EEDR (optional). 4. Write a logical one to the EEMWE bit in EECR (to be able to write a logical one to the EEMWE bit, the EEWE bit must be written to zero in the same cycle). 5. Within four clock cycles after setting EEMWE, write a logical one to EEWE. Caution: An interrupt between step 4 and step 5 will make the write cycle fail, since the EEPROM Master Write Enable will time-out. If an interrupt routine accessing the EEPROM is interrupting another EEPROM access, the EEAR or EEDR register will be modified, causing the interrupted EEPROM access to fail. It is recommended to have the global interrupt flag cleared during the four last steps to avoid these problems. When the write access time has elapsed, the EEWE bit is cleared (zero) by hardware. The user software can poll this bit and wait for a zero before writing the next byte. When EEWE has been set, the CPU is halted for two cycles before the next instruction is executed. * Bit 0 - EERE: EEPROM Read Enable The EEPROM Read Enable Signal EERE is the read strobe to the EEPROM. When the correct address is set up in the EEAR register, the EERE bit must be set. When the EERE bit is cleared (zero) by hardware, requested data is found in the EEDR register. The EEPROM read access takes one instruction and there is no need to poll the EERE bit. When EERE has been set, the CPU is halted for four cycles before the next instruction is executed. The user should poll the EEWE bit before starting the read operation. If a write operation is in progress when new data or address is written to the EEPROM I/O registers, the write operation will be interrupted, and the result is undefined. The calibrated oscillator is used to time EEPROM. In Table 17 the typical programming time is listed for EEPROM access from the CPU. Table 17. Typical EEPROM Programming Times
Parameter EEPROM write (from CPU) Number of Calibrated RC Oscillator Cycles 4096 Min Programming Time 3.1 ms Max Programming Time 6.8 ms
39
1006D-AVR-07/03
Prevent EEPROM Corruption
During periods of low VCC, the EEPROM data can be corrupted because the supply voltage is too low for the CPU and the EEPROM to operate properly. These issues are the same as for board-level systems using the EEPROM, and the same design solutions should be applied. An EEPROM data corruption can be caused by two situations when the voltage is too low. First, a regular write sequence to the EEPROM requires a minimum voltage to operate correctly. Secondly, the CPU itself can execute instructions incorrectly if the supply voltage for executing instructions is too low. EEPROM data corruption can easily be avoided by following these design recommendations (one is sufficient): 1. Keep the AVR RESET active (low) during periods of insufficient power supply voltage. This can be done by enabling the internal Brown-out Detector (BOD) if the operating speed matches the detection level. If not, an external low VCC Reset Protection circuit can be applied. 2. Keep the AVR core in Power-down Sleep Mode during periods of low VCC. This will prevent the CPU from attempting to decode and execute instructions, effectively protecting the EEPROM registers from unintentional writes. 3. Store constants in Flash memory if the ability to change memory contents from software is not required. Flash memory can not be updated by the CPU, and will not be subject to corruption.
40
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Analog Comparator
The Analog Comparator compares the input values on the positive input PB0 (AIN0) and negative input PB1 (AIN1). When the voltage on the positive input PB0 (AIN0) is higher than the voltage on the negative input PB1 (AIN1), the Analog Comparator Output (ACO) is set (one). The comparator's output can trigger a separate interrupt, exclusive to the Analog Comparator. The user can select interrupt triggering on comparator output rise, fall or toggle. A block diagram of the comparator and its surrounding logic is shown in Figure 26. Figure 26. Analog Comparator Block Diagram.
INTERNAL VOLTAGE REFERENCE (ATtiny12 ONLY)
AINBG MUX
Analog Comparator Control and Status Register - ACSR
Bit $08 Read/Write Initial Value
7 ACD R/W 0
6 (AINBG) R(/W) 0
5 ACO R X
4 ACI R/W 0
3 ACIE R/W 0
2 R 0
1 ACIS1 R/W 0
0 ACIS0 R/W 0 ACSR
Note:
AINBG is only available in ATtiny12.
* Bit 7 - ACD: Analog Comparator Disable When this bit is set (one), the power to the Analog Comparator is switched off. This bit can be set at any time to turn off the Analog Comparator. When changing the ACD bit, the Analog Comparator Interrupt must be disabled by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when the bit is changed. * Bit 6 - AINBG: Analog Comparator Bandgap Select in ATtiny12 In ATtiny12, when this bit is set, a fixed bandgap voltage of 1.22 0.05V replaces the normal input to the positive input (AIN0) of the comparator. When this bit is cleared, the normal input pin PB0 is applied to the positive input of the comparator. * Bit 6- Res: Reserved Bit in ATTINY11 This bit is a reserved bit in the ATTINY11 and will always read as zero. * Bit 5 - ACO: Analog Comparator Output ACO is directly connected to the comparator output. * Bit 4 - ACI: Analog Comparator Interrupt Flag This bit is set (one) when a comparator output event triggers the interrupt mode defined by ACI1 and ACI0. The Analog Comparator Interrupt routine is executed if the ACIE bit is set (one) and the I-bit in SREG is set (one). ACI is cleared by hardware when execut41
1006D-AVR-07/03
ing the corresponding interrupt handling vector. Alternatively, ACI is cleared by writing a logic one to the flag. * Bit 3 - ACIE: Analog Comparator Interrupt Enable When the ACIE bit is set (one) and the I-bit in the Status Register is set (one), the Analog Comparator Interrupt is activated. When cleared (zero), the interrupt is disabled. * Bit 2 - Res: Reserved Bit This bit is a reserved bit in the ATTINY11/12 and will always read as zero. * Bits 1,0 - ACIS1, ACIS0: Analog Comparator Interrupt Mode Select These bits determine which comparator events that trigger the Analog Comparator Interrupt. The different settings are shown in Table 18. Table 18. ACIS1/ACIS0 Settings
ACIS1 0 0 1 1 Note: ACIS0 0 1 0 1 Interrupt Mode Comparator Interrupt on Output Toggle Reserved Comparator Interrupt on Falling Output Edge Comparator Interrupt on Rising Output Edge
When changing the ACIS1/ACIS0 bits, the Analog Comparator Interrupt must be disabled by clearing its interrupt enable bit in the ACSR register. Otherwise, an interrupt can occur when the bits are changed.
Caution: Using the SBI or CBI instruction on bits other than ACI in this register will write a one back into ACI if it is read as set, thus clearing the flag.
42
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
I/O Port B
All AVR ports have true read-modify-write functionality when used as general digital I/O ports. This means that the direction of one port pin can be changed without unintentionally changing the direction of any other pin with the SBI and CBI instructions. The same applies for changing drive value (if configured as output) or enabling/disabling of pull-up resistors (if configured as input). Port B is a 6-bit bi-directional I/O port. Three I/O memory address locations are allocated for Port B, one each for the Data Register - PORTB, $18, Data Direction Register - DDRB, $17, and the Port B Input Pins - PINB, $16. The Port B Input Pins address is read only, while the Data Register and the Data Direction Register are read/write. Ports PB5..3 have special functions as described in the section "Pin Descriptions" on page 5. If PB5 is not configured as external reset, it is input with no pull-up. On ATtiny12, it can also output a logical zero, acting as an open-drain output. Note that, since PB5 only has one possible output value, the output functionality of this pin is controlled by the DDRB register alone. If PB4 and/or PB3 are not used for clock function, they are I/O pins. All I/O pins have individually selectable pull-ups. The Port B output buffers on PB0 to PB4 can sink 20 mA and thus drive LED displays directly. On ATtiny12, PB5 can sink 12 mA. When pins PB0 to PB4 are used as inputs and are externally pulled low, they will source current (IIL ) if the internal pull-ups are activated. The Port B pins with alternate functions are shown in Table 19: Table 19. Port B Pins Alternate Functions
Port Pin PB0 MOSI (Data Input Line for Memory Downloading) INT0 (External Interrupt0 Input) PB1 AIN1 (Analog Comparator Negative Input) MOSI (Data Output Line for Memory Downloading) T0 (Timer/Counter0 External Counter Input) PB2 SCK (Serial Clock Input for Serial Programming) PB3 PB4 PB5 XTAL1 (Oscillator Input) XTAL2 (Oscillator Output) RESET (External Reset Pin) ATtiny12 ATTINY11/12 ATTINY11/12 ATTINY11/12 ATtiny12 ATTINY11/12 ATTINY11/12 ATtiny12 ATTINY11/12 Alternate Functions AIN0 (Analog Comparator Positive Input) Device ATTINY11/12
When the pins PB2..0 are used for the alternate function, the DDRB and PORTB register has to be set according to the alternate function description. When PB5..3 are used for alternate functions, the values in the corresponding DDRB and PORTB bits are ignored.
43
1006D-AVR-07/03
Port B Data Register - PORTB
Bit $18 Read/Write Initial Value 7
-
6
-
5
-
4
PORTB4
3
PORTB3
2
PORTB2
1
PORTB1
0
PORTB0 PORTB
R 0
R 0
R 0
R/W 0
R/W 0
R/W 0
R/W 0
R/W 0
Port B Data Direction Register - DDRB
Bit $17 Read/Write Initial Value
7 R 0
6 R 0
5 (DDB5) R(/W) 0
4 DDB4 R/W 0
3 DDB3 R/W 0
2 DDB2 R/W 0
1 DDB1 R/W 0
0 DDB0 R/W 0 DDRB
Note:
DDB5 is only available in ATtiny12.
Port B Input Pins Address - PINB
Bit $16 Read/Write Initial Value
7 R 0
6 R 0
5 PINB5 R N/A
4 PINB4 R N/A
3 PINB3 R N/A
2 PINB2 R N/A
1 PINB1 R N/A
0 PINB0 R N/A PINB
The Port B Input Pins address - PINB - is not a register, and this address enables access to the physical value on each Port B pin. When reading PORTB, the Port B Data Latch is read, and when reading PINB, the logical values present on the pins are read. Port B as General Digital I/O The lowermost five pins in port B have equal functionality when used as digital I/O pins. PBn, General I/O pin: The DDBn bit in the DDRB register selects the direction of this pin, if DDBn is set (one), PBn is configured as an output pin. If DDBn is cleared (zero), PBn is configured as an input pin. If PORTBn is set (one) when the pin is configured as an input pin, the MOS pull-up resistor is activated. On ATtiny12 this feature can be disabled by setting the Pull-up Disable (PUD) bit in the MCUCR register. To switch the pullup resistor off, the PORTBn can be cleared (zero), the pin can be configured as an output pin, or in ATtiny12, the PUD bit can be set. The port pins are tri-stated when a reset condition becomes active, even if the clock is not running. Table 20. DDBn Effects on Port B Pins
DDBn 0 0 1 1 PORTBn 0 1 0 1 I/O Input Input Output Output Pull-up No Yes No No Comment Tri-state (Hi-Z) PBn will source current if ext. pulled low. In ATtiny12 pull-ups can be disabled by setting the PUD bit. Push-pull Zero Output Push-pull One Output
n: 4,3...0, pin number. Note that in ATTINY11, PB5 is input only. On ATtiny12, PB5 is input or open-drain output. Because this pin is used for 12V programming, there is no ESD protection diode limiting the voltage on the pin to VCC + 0.5V. Thus, special care should be taken to ensure that the voltage on this pin does not rise above VCC + 1V during normal operation. This may cause the MCU to reset or enter programming mode unintentionally.
44
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Alternate Functions of Port B All port B pins are connected to a pin change detector that can trigger the pin change interrupt. See "Pin Change Interrupt" on page 27 for details. In addition, Port B has the following alternate functions: * RESET - Port B, Bit 5 When the RSTDISBL fuse is unprogrammed, this pin serves as external reset. When the RSTDISBL fuse is programmed, this pin is a general input pin. In ATtiny12, it is also an open-drain output pin. * XTAL2 - Port B, Bit 4 XTAL2, oscillator output. When this pin is not used for clock purposes, it is a general I/O pin. Refer to section "Pin Descriptions" on page 5 for details. * XTAL1 - Port B, Bit 3 XTAL1, oscillator or clock input. When this pin is not used for clock purposes, it is a general I/O pin. Refer to section "Pin Descriptions" on page 5 for details. * T0/SCK - Port B, Bit 2 This pin can serve as the external counter clock input. See the timer/counter description for further details. If external timer/counter clocking is selected, activity on this pin will clock the counter even if it is configured as an output. In ATtiny12 and serial programming mode, this pin serves as the serial clock input, SCK. * INT0/AIN1/MISO - Port B, Bit 1 This pin can serve as the external interrupt0 input. See the interrupt description for details on how to enable this interrupt. Note that activity on this pin will trigger the interrupt even if the pin is configured as an output. This pin also serves as the negative input of the on-chip Analog Comparator. In ATtiny12 and serial programming mode, this pin serves as the serial data input, MISO. * AIN0/MOSI - Port B, Bit 0 This pin also serves as the positive input of the on-chip Analog Comparator. In ATtiny12 and serial programming mode, this pin serves as the serial data output, MOSI. During Power-down Mode, the schmitt triggers of the digital inputs are disconnected on the Analog Comparator input pins. This allows an analog voltage close to VCC/2 to be present during power-down without causing excessive power consumption.
45
1006D-AVR-07/03
Memory Programming
Program (and Data) Memory Lock Bits
The ATTINY11/12 MCU provides two lock bits which can be left unprogrammed ("1") or can be programmed ("0") to obtain the additional features listed in Table 21. The lock bits can only be erased with the Chip Erase command. Table 21. Lock Bit Protection Modes
Memory Lock Bits Mode 1 2 3 Note: LB1 1 0 0 LB2 1 1 0 Protection Type No memory lock features enabled. Further programming of the Flash (and EEPROM for ATtiny12) is disabled.(1) Same as mode 2, and verify is also disabled.
1. In the High-voltage Serial Programming mode, further programming of the fuse bits are also disabled. Program the fuse bits before programming the lock bits.
Fuse Bits in ATTINY11
The ATTINY11 has five fuse bits, FSTRT, RSTDISBL and CKSEL2..0. * * * FSTRT: See Table 7, "Start-up Times for the ATTINY11 (VCC = 2.7V)," on page 18 for which value to use. Default value is unprogrammed ("1"). When RSTDISBL is programmed ("0"), the external reset function of pin PB5 is disabled.(1) Default value is unprogrammed ("1"). CKSEL2..0: See Table 3, "Device Clocking Options Select," on page 5, for which combination of CKSEL2..0 to use. Default value is "100", internal RC oscillator.
1. If the RSTDISBL Fuse is programmed, then the programming hardware should apply +12V to PB5 while the ATTINY11 is in Power-on Reset. If not, the part can fail to enter programming mode caused by drive contention on PB0.
The status of the fuse bits is not affected by Chip Erase.
Note:
Fuse Bits in ATtiny12
The ATtiny12 has eight fuse bits, BODLEVEL, BODEN, SPIEN, RSTDISBL and CKSEL3..0. All the fuse bits are programmable in both High-voltage and Low-voltage Serial programming modes. Changing the fuses does not have any effect while in programming mode. * The BODLEVEL Fuse selects the Brown-out Detection level and changes the startup times. See "Brown-out Detection (ATtiny12)" on page 22. See Table 9, "ATtiny12 Clock Options and Start-up Times," on page 20. Default value is programmed ("0"). When the BODEN Fuse is programmed ("0"), the Brown-out Detector is enabled. See "Brown-out Detection (ATtiny12)" on page 22. Default value is unprogrammed ("1"). When the SPIEN Fuse bit is programmed ("0"), Low-Voltage Serial Program and Data Downloading is enabled. Default value is programmed ("0"). Unprogramming this fuse while in the Low-Voltage Serial Programming mode will disable future insystem downloading attempts. When the RSTDISBL Fuse is programmed ("0"), the external reset function of pin PB5 is disabled.(1) Default value is unprogrammed ("1"). Programming this fuse while in the Low-Voltage Serial Programming mode will disable future in-system downloading attempts.
*
*
*
46
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
* CKSEL3..0 fuses: See Table 3, "Device Clocking Options Select," on page 5 and Table 9, "ATtiny12 Clock Options and Start-up Times," on page 20, for which combination of CKSEL3..0 to use. Default value is "0010", internal RC oscillator with long start-up time.
1. If the RSTDISBL Fuse is programmed, then the programming hardware should apply +12V to PB5 while the ATtiny12 is in Power-on Reset. If not, the part can fail to enter programming mode caused by drive contention on PB0 and/or PB5.
The status of the fuse bits is not affected by Chip Erase.
Note:
Signature Bytes
All Atmel microcontrollers have a three-byte signature code which identifies the device. The three bytes reside in a separate address space. For the ATTINY11 they are: 1. $000: $1E (indicates manufactured by Atmel) 2. $001: $90 (indicates 1 Kb Flash memory) 3. $002: $04 (indicates ATTINY11 device when signature byte $001 is $90) For the ATtiny12(1) they are: 1. $000: $1E (indicates manufactured by Atmel) 2. $001: $90 (indicates 1 Kb Flash memory) 3. $002: $05 (indicates ATtiny12 device when signature byte $001 is $90)
Note: 1. When both lock bits are programmed (Lock mode 3), the Signature Bytes can not be read in the Low-voltage Serial mode. Reading the Signature Bytes will return: $00, $01 and $02.
Calibration Byte in ATtiny12
The ATtiny12 has a one-byte calibration value for the internal RC oscillator. This byte resides in the high byte of address $000 in the signature address space. During memory programming, the external programmer must read this location and program its value into a selected location in the normal Flash Program memory. At start-up, the user software must read this Flash location and write the value to the OSCCAL register.
Programming the Flash and EEPROM
ATTINY11 Atmel's ATTINY11 offers 1K bytes of Flash Program memory. The ATTINY11 is shipped with the on-chip Flash Program memory array in the erased state (i.e., contents = $FF) and ready to be programmed. This device supports a High-voltage (12V) Serial programming mode. Only minor currents (<1 mA) are drawn from the +12V pin during programming. The program memory array in the ATTINY11 is programmed byte-by-byte. ATtiny12 Atmel's ATtiny12 offers 1K bytes of in-system reprogrammable Flash Program memory and 64 bytes of in-system reprogrammable EEPROM Data memory. The ATtiny12 is shipped with the on-chip Flash Program and EEPROM Data memory arrays in the erased state (i.e., contents = $FF) and ready to be programmed. This device supports a high-voltage (12V) serial programming mode and a low-voltage serial programming mode. The +12V is used for programming enable only, and no current of significance is drawn by this pin. The Low-voltage Serial Programming mode
47
1006D-AVR-07/03
provides a convenient way to download program and data into the ATtiny12 inside the user's system. The program and data memory arrays in the ATtiny12 are programmed byte-by-byte in either programming mode. For the EEPROM, an auto-erase cycle is provided within the self-timed write instruction in the Low-voltage Serial Programming mode. ATTINY11/12 During programming, the supply voltage must be in accordance with Table 22. Table 22. Supply Voltage during Programming
Part ATTINY11L ATTINY11 ATtiny12V ATtiny12L ATtiny12 Low-voltage Serial Programming Not applicable Not applicable 2.2 - 5.5V 2.7 - 5.5V 4.0 - 5.5V High-voltage Serial Programming 4.5 - 5.5V 4.5 - 5.5V 4.5 - 5.5V 4.5 - 5.5V 4.5 - 5.5V
High-voltage Serial Programming
This section describes how to program and verify Flash Program memory, EEPROM Data memory (ATtiny12), lock bits and fuse bits in the ATTINY11/12. Figure 27. High-voltage Serial Programming
11.5 - 12.5V 4.5 - 5.5V
ATtiny
PB5 (RESET) VCC
SERIAL CLOCK INPUT
PB3 (XTAL1)
PB2 PB1
SERIAL DATA OUTPUT SERIAL INSTR. INPUT SERIAL DATA INPUT
GND
PB0
48
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
High-voltage Serial Programming Algorithm
To program and verify the ATTINY11/12 in the High-voltage Serial Programming mode, the following sequence is recommended (See instruction formats in Table 23): 1. Power-up sequence: Apply 4.5 - 5.5V between VCC and GND. Set PB5 and PB0 to "0" and wait at least 100 ns. Toggle PB3 at least four times with minimum 100 ns pulse-width. Set PB3 to "0". Wait at least 100 ns. Apply 12V to PB5 and wait at least 100 ns before changing PB0. Wait 8 s before giving any instructions. 2. The Flash array is programmed one byte at a time by supplying first the address, then the low and high data byte. The write instruction is self-timed, wait until the PB2 (RDY/BSY) pin goes high. 3. The EEPROM array (ATtiny12 only) is programmed one byte at a time by supplying first the address, then the data byte. The write instruction is self-timed, wait until the PB2 (RDY/BSY) pin goes high. 4. Any memory location can be verified by using the Read instruction which returns the contents at the selected address at serial output PB2. 5. Power-off sequence:Set PB3 to "0". Set PB5 to "1". Turn VCC power off. When writing or reading serial data to the ATTINY11/12, data is clocked on the rising edge of the serial clock, see Figure 28, Figure 29 and Table 24 for details.
49
1006D-AVR-07/03
Figure 28. High-voltage Serial Programming Waveforms
SERIAL DATA INPUT PB0 MSB LSB
SERIAL INSTR. INPUT PB1
MSB
LSB
SERIAL DATA OUTPUT PB2
MSB
LSB
SERIAL CLOCK INPUT XTAL1/PB3
0
1
2
3
4
5
6
7
8
9
10
Table 23. High-voltage Serial Programming Instruction Set for ATTINY11/12
Instruction Format Instruction
Chip Erase PB0 PB1 PB2 Write Flash High and Low Address PB0 PB1 PB2
Instr.1
0_1000_0000_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0001_0000_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_ i i i i_i i i i _00 0_0010_1100_00 x_xxxx_xxxx_xx 0_ i i i i_i i i i _00 0_0011_1100_00 x_xxxx_xxxx_xx 0_0000_0010_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1000_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0111_1000_00 x_xxxx_xxxx_xx 0_0001_0001_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_ i i i i_i i i i _00 0_0010_1100_00 x_xxxx_xxxx_xx 0_0000_0011_00 0_0100_1100_00 x_xxxx_xxxx_xx
Instr.2
0_0000_0000_00 0_0110_0100_00 x_xxxx_xxxx_xx 0_0000_000a_00 0_0001_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_0100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0111_0100_00 x_xxxx_xxxx_xx 0_0000_000a_00 0_0001_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1100_00 o_oooo_ooox_xx 0_0000_0000_00 0_0111_1100_00 o_oooo_ooox_xx 0_00bb_bbbb_00 0_0000_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_0100_00 x_xxxx_xxxx_xx 0_00bb_bbbb_00 0_0000_1100_00 x_xxxx_xxxx_xx
Instr.3
0_0000_0000_00 0_0110_1100_00 x_xxxx_xxxx_xx 0_bbbb_bbbb_00 0_0000_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1100_00 0_0000_0000_00 0_0000_0000_00 0_0111_1100_00 0_0000_0000_00 0_bbbb_bbbb_00 0_0000_1100_00 x_xxxx_xxxx_xx
Instr.4
0_0000_0000_00 0_0100_1100_00 x_xxxx_xxxx_xx
Operation Remarks
Wait after Instr.4 until PB2 goes high for the Chip Erase cycle to finish. Repeat Instr.2 for a new 256 byte page. Repeat Instr.3 for each new address. Wait after Instr.3 until PB2 goes high. Repeat Instr.1, Instr. 2 and Instr.3 for each new address. Wait after Instr.3 until PB2 goes high. Repeat Instr.1, Instr. 2 and Instr.3 for each new address. Repeat Instr.2 and Instr.3 for each new address.
PB0 Write Flash Low PB1 byte PB2 Write Flash High byte Read Flash High and Low Address Read Flash Low byte PB0 PB1 PB2 PB0 PB1 PB2 PB0 PB1 PB2 PB0 PB1 PB2
Repeat Instr.1 and Instr.2 for each new address.
Read Flash High byte
Repeat Instr.1 and Instr.2 for each new address.
Write EEPROM PB0 PB1 Low Address (ATtiny12) PB2 PB0 Write EEPROM PB1 byte (ATtiny12) PB2 Read EEPROM PB0 Low Address PB1 (ATtiny12) PB2
Repeat Instr.2 for each new address. 0_0000_0000_00 0_0110_1100_00 0_0000_0000_00
Wait after Instr.3 until PB2 goes high
Repeat Instr.2 for each new address.
50
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Table 23. High-voltage Serial Programming Instruction Set for ATTINY11/12 (Continued)
Instruction Format Instruction
PB0 Read EEPROM PB1 byte (ATtiny12) PB2 Write Fuse bits (ATTINY11) PB0 PB1 PB2 PB0 PB1 PB2 PB0 Write Lock bits PB1 PB2 PB0 PB1 PB2 PB0 PB1 PB2 PB0 Read Lock bits PB1 PB2
Instr.1
0_0000_0000_00 0_0110_1000_00 x_xxxx_xxxx_xx 0_0100_0000_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0100_0000_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0010_0000_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0000_0100_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0000_0100_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0000_0100_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0000_1000_00 0_0100_1100_00 x_xxxx_xxxx_xx 0_0000_1000_00 0_0100_1100_00 x_xxxx_xxxx_xx
Instr.2
0_0000_0000_00 0_0110_1100_00 o_oooo_ooox_xx 0_0007_6543_00 0_0010_1100_00 x_xxxx_xxxx_xx 0_CBA9_8543_00 0_0010_1100_00 x_xxxx_xxxx_xx 0_0000_0210_00 0_0010_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1000_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1000_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0111_1000_00 x_xxxx_xxxx_xx 0_0000_00bb_00 0_0000_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0000_1100_00 x_xxxx_xxxx_xx
Instr.3
Instr.4
Operation Remarks
Repeat Instr.2 for each new address
0_0000_0000_00 0_0110_0100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_0100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_0100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1100_00 x_xx76_543x_xx 0_0000_0000_00 0_0110_1100_00 C_BA98_543x_xx 0_0000_0000_00 0_0111_1100_00 x_xxxx_21xx_xx 0_0000_0000_00 0_0110_1000_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0111_1000_00 x_xxxx_xxxx_xx
0_0000_0000_00 0_0110_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1100_00 0_0000_0000_00
Wait tWLWH_PFB after Instr.3 for the Write fuse bits cycle to finish. Write 7 - 3 = "0" to program the fuse bit. Wait after Instr.4 until PB2 goes high. Write C - A, 9, 8, 5 - 3 = "0" to program the fuse bit. Wait after Instr.4 until PB2 goes high. Write 2, 1 = "0" to program the lock bit. Reading 7 - 3 = "0" means the fuse bit is programmed.
Write Fuse bits (ATtiny12)
Read Fuse bits (ATTINY11)
Read Fuse bits (ATtiny12)
Reading C - A, 9, 8, 5 - 3 = "0" means the fuse bit is programmed.
Reading 2, 1 = "0" means the lock bit is programmed. 0_0000_0000_00 0_0110_1100_00 o_oooo_ooox_xx 0_0000_0000_00 0_0111_1100_00 o_oooo_ooox_xx
PB0 Read Signature PB1 Bytes PB2 PB0 Read Calibration Byte PB1 (ATtiny12) PB2
Repeat Instr.2 - Instr.4 for each signature byte address
Note:
a = address high bits b = address low bits i = data in o = data out x = don't care 1 = Lock Bit1 2 = Lock Bit2 3 = CKSEL0 Fuse 4 = CKSEL1 Fuse 5 = CKSEL2 Fuse 9, 6 = RSTDISBL Fuse 7 = FSTRT Fuse 8 = CKSEL3 Fuse A = SPIEN Fuse B = BODEN Fuse C = BODLEVEL Fuse
51
1006D-AVR-07/03
High-voltage Serial Programming Characteristics
Figure 29. High-voltage Serial Programming Timing
SDI (PB0), SII (PB1)
tIVSH
SCI (PB3) SDO (PB2)
tSHIX tSHSL tSHOV
tSLSH
Table 24. High-voltage Serial Programming Characteristics TA = 25C 10%, VCC = 5.0V 10% (Unless otherwise noted)
Symbol tSHSL tSLSH tIVSH tSHIX tSHOV tWLWH_PFB Parameter SCI (PB3) Pulse Width High SCI (PB3) Pulse Width Low SDI (PB0), SII (PB1) Valid to SCI (PB3) High SDI (PB0), SII (PB1) Hold after SCI (PB3) High SCI (PB3) High to SDO (PB2) Valid Wait after Instr. 3 for Write Fuse Bits Min 100 100 50 50 10 1.7 16 2.5 32 3.4 Typ Max Units ns ns ns ns ns ms
Low-voltage Serial Downloading (ATtiny12 only)
Both the program and data memory arrays can be programmed using the SPI bus while RESET is pulled to GND. The serial interface consists of pins SCK, MOSI (input) and MISO (output), see Figure 30. After RESET is set low, the Programming Enable instruction needs to be executed first before program/erase instructions can be executed. Figure 30. Serial Programming and Verify
2.2 - 5.5V
ATtiny12
GND
PB5 (RESET) VCC
PB2 PB1 GND PB0
SCK MISO MOSI
52
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
If the chip Erase command in Low-voltage Serial Programming is executed only once, one data byte may be written to the flash after erase. Using the following algorithm guarantees that the flash will be erased: * * * Execute a chip erase command Write $FF to address $00 in the flash Execute a second chip erase command
For the EEPROM, an auto-erase cycle is provided within the self-timed write instruction and there is no need to first execute the Chip Erase instruction. The Chip Erase instruction turns the content of every memory location in both the program and EEPROM arrays into $FF. The program and EEPROM memory arrays have separate address spaces: $0000 to $01FF for program memory and $000 to $03F for EEPROM memory. The device can be clocked by any clock option during Low-voltage Serial Programming. The minimum low and high periods for the serial clock (SCK) input are defined as follows: Low: > 2 MCU clock cycles High: > 2 MCU clock cycles Low-voltage Serial Programming Algorithm When writing serial data to the ATtiny12, data is clocked on the rising edge of SCK. When reading data from the ATtiny12, data is clocked on the falling edge of SCK. See Figure 31, Figure 32 and Table 26 for timing details. To program and verify the ATtiny12 in the serial programming mode, the following sequence is recommended (See 4 byte instruction formats in Table 25): 1. Power-up sequence: Apply power between VCC and GND while RESET and SCK are set to "0". In accordance with the setting of CKSEL fuses, apply a crystal/resonator, external clock or RC network, or let the device run on the internal RC oscillator. In some systems, the programmer can not guarantee that SCK is held low during power-up. In this case, RESET must be given a positive pulse of at least two MCU cycles duration after SCK has been set to "0". 2. Wait for at least 20 ms and enable serial programming by sending the Programming Enable Serial instruction to the MOSI (PB0) pin. 3. The serial programming instructions will not work if the communication is out of synchronization. When in sync, the second byte ($53) will echo back when issuing the third byte of the Programming Enable instruction. Whether the echo is correct or not, all 4 bytes of the instruction must be transmitted. If the $53 did not echo back, give SCK a positive pulse and issue a new Programming Enable instruction. If the $53 is not seen within 32 attempts, there is no functional device connected. 4. If a Chip Erase is performed (must be done to erase the Flash), wait tWD_ERASE after the instruction, give RESET a positive pulse, and start over from Step 2. See Table 27 on page 56 for tWD_ERASE value. 5. The Flash or EEPROM array is programmed one byte at a time by supplying the address and data together with the appropriate Write instruction. An EEPROM memory location is first automatically erased before new data is written. Use Data Polling to detect when the next byte in the Flash or EEPROM can be written. If polling is not used, wait tWD_FLASH or tWD_EEPROM before transmitting the
53
1006D-AVR-07/03
next instruction. See Table 28 on page 56 for tWD_FLASH and tWD_EEPROM values. In an erased device, no $FFs in the data file(s) needs to be programmed. 6. Any memory location can be verified by using the Read instruction which returns the content at the selected address at the serial output MISO (PB1) pin. 7. At the end of the programming session, RESET can be set high to commence normal operation. 8. Power-off sequence (if needed): Set XTAL1 to "0" (if external clocking is used). Set RESET to "1". Turn VCC power off. Data Polling When a byte is being programmed into the Flash or EEPROM, reading the address location being programmed will give the value $FF. At the time the device is ready for a new byte, the programmed value will read correctly. This is used to determine when the next byte can be written. This will not work for the value $FF, so when programming this value, the user will have to wait for at least tWD_FLASH or tWD_EEPROM before programming the next byte. As a chip-erased device contains $FF in all locations, programming of addresses that are meant to contain $FF can be skipped. This does not apply if the EEPROM is reprogrammed without chip-erasing the device. In that case, data polling cannot be used for the value $FF, and the user will have to wait at least t WD_EEPROM before programming the next byte. See Table 28 for tWD_FLASH and tWD_EEPROM values. Figure 31. Low-voltage Serial Programming Waveforms
SERIAL DATA INPUT PB0(MOSI) SERIAL DATA OUTPUT PB1(MISO) SERIAL CLOCK INPUT PB2(SCK) MSB LSB
MSB
LSB
54
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Table 25. Low-voltage Serial Programming Instruction Set
Instruction Format Instruction Programming Enable Chip Erase Byte 1 1010 1100 1010 1100 0010 H000 Read Program Memory 0100 H000 Write Program Memory Read EEPROM Memory Write EEPROM Memory Write Lock Bits Read Lock Bits Read Signature Bytes Read Calibration Byte Write Fuse Bits Read Fuse Bits Note: 1010 0000 1100 0000 1010 1100 0101 1000 0011 0000 0011 1000 1010 1100 0101 0000 xxxx xxxx xxxx xxxx 1111 1211 xxxx xxxx xxxx xxxx xxxx xxxx 101x xxxx xxxx xxxx xxbb bbbb xxbb bbbb xxxx xxxx xxxx xxxx 0000 00bb 0000 0000 xxxx xxxx xxxx xxxx oooo oooo iiii iiii xxxx xxxx xxxx x21x oooo oooo oooo oooo A987 6543 A987 6543 Set bits A, 9 - 3 = "0" to program, "1" to unprogram. Read fuse bits. "0" = programmed, "1" = unprogrammed. xxxx xxxa bbbb bbbb iiii iiii Byte 2 0101 0011 100x xxxx xxxx xxxa Byte 3 xxxx xxxx xxxx xxxx bbbb bbbb Byte4 xxxx xxxx xxxx xxxx oooo oooo Operation Enable serial programming while RESET is low. Chip erase Flash and EEPROM memory arrays. Read H (high or low) data o from program memory at word address a:b. Write H (high or low) data i to program memory at word address a:b. Read data o from EEPROM memory at address b. Write data i to EEPROM memory at address b. Write lock bits. Set bits 1,2 = "0" to program lock bits. Read lock bits. "0" = programmed, "1" = unprogrammed. Read signature byte o at address b.(1)
a = address high bits b = address low bits H = 0 - Low byte, 1 - High byte o = data out i = data in x = don't care 1 = Lock bit 1 2 = Lock bit 2 3 = CKSEL0 Fuse 4 = CKSEL1 Fuse 5 = CKSEL2 Fuse 6 = CKSEL3 Fuse 7 = RSTDISBL Fuse 8 = SPIEN Fuse 9 = BODEN Fuse A = BODLEVEL Fuse 1. The signature bytes are not readable in Lock mode 3, i.e. both lock bits programmed.
Note:
55
1006D-AVR-07/03
Low-voltage Serial Programming Characteristics
Figure 32. Low-voltage Serial Programming Timing
MOSI tOVSH SCK MISO tSLIV tSHSL tSHOX tSLSH
Table 26. Low-voltage Serial Programming Characteristics TA = -40C to 85C, VCC = 2.2 - 5.5V (Unless otherwise noted)
Symbol 1/tCLCL tCLCL 1/tCLCL tCLCL 1/tCLCL tCLCL tSHSL tSLSH tOVSH tSHOX tSLIV Parameter Oscillator Frequency (VCC = 2.2 - 2.7V) Oscillator Period (VCC = 2.2 - 2.7V) Oscillator Frequency (VCC = 2.7 - 4.0V) Oscillator Period (VCC = 2.7 - 4.0V) Oscillator Frequency (VCC = 4.0 - 5.5V) Oscillator Period (VCC = 4.0 - 5.5V) SCK Pulse Width High SCK Pulse Width Low MOSI Setup to SCK High MOSI Hold after SCK High SCK Low to MISO Valid Min 0 1000 0 250 0 125 2 tCLCL 2 tCLCL tCLCL 2 tCLCL 10 16 32 8 4 Typ Max 1 Units MHz ns MHz ns MHz ns ns ns ns ns ns
Table 27. Minimum Wait Delay after the Chip Erase Instruction
Symbol tWD_ERASE Minimum Wait Delay 6.8 ms
Table 28. Minimum Wait Delay after Writing a Flash or EEPROM Location
Symbol tWD_FLASH tWD_EEPROM Minimum Wait Delay 3.4 ms 6.8 ms
56
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Electrical Characteristics
Absolute Maximum Ratings
Operating Temperature .................................. -55C to +125C Storage Temperature ..................................... -65C to +150C Voltage on any Pin except RESET with respect to Ground ................................-1.0V to VCC+0.5V Voltage on RESET with respect to Ground......-1.0V to +13.0V Maximum Operating Voltage ............................................ 6.0V DC Current per I/O Pin ............................................... 40.0 mA DC Current VCC and GND Pins................................ 100.0 mA *NOTICE: Stresses beyond those ratings listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.
DC Characteristics - Preliminary Data
TA = -40C to 85C, VCC = 2.7V to 5.5V for ATTINY11, VCC = 1.8V to 5.5V for ATtiny12 (Unless otherwise noted)
Symbol VIL VIL1 VIH VIH1 VIH2 VOL VOL VOH IIL IIH RI/O Parameter Input Low Voltage Input Low Voltage Input High Voltage Input High Voltage Input High Voltage Output Low Voltage Port B Output Low Voltage PB5 (ATtiny12) Output High Voltage(4) Port B Input Leakage Current I/O Pin Input Leakage Current I/O Pin I/O Pin Pull-Up
(3)
Condition Except (XTAL) XTAL Except (XTAL, RESET) XTAL RESET IOL = 20 mA, VCC = 5V IOL = 10 mA, VCC = 3V IOL = 12 mA, VCC = 5V IOL = 6 mA, VCC = 3V IOH = -3 mA, VCC = 5V IOH = -1.5 mA, VCC = 3V VCC = 5.5V, Pin Low (Absolute value) VCC = 5.5V, Pin High (Absolute value)
Min -0.5 -0.5 0.6 VCC
(2)
Typ
Max 0.3 VCC(1) 0.1 VCC
(1)
Units V V V V V V V V V V V
VCC + 0.5 VCC + 0.5 VCC + 0.5 0.6 0.5 0.6 0.5
0.7 VCC (2) 0.85 VCC(2)
4.3 2.3 8.0 8.0 35 122
A A k
57
1006D-AVR-07/03
DC Characteristics - Preliminary Data (Continued)
TA = -40C to 85C, VCC = 2.7V to 5.5V for ATTINY11, VCC = 1.8V to 5.5V for ATtiny12 (Unless otherwise noted)
Symbol Parameter Condition Active 1 MHz, VCC = 3V (ATtiny12V) Active 2 MHz, VCC = 3V (ATTINY11L) Active 4 MHz, VCC = 3V (ATtiny12L) Active 6 MHz, VCC = 5V (ATTINY11) Active 8 MHz, VCC = 5V (ATtiny12) Idle 1 MHz, VCC = 3V (ATtiny12V) ICC Power Supply Current Idle 2 MHz, VCC = 3V (ATTINY11L) Idle 4 MHz, VCC = 3V (ATtiny12L) Idle 6 MHz, VCC = 5V (ATTINY11) Idle 8 MHz, VCC = 5V (ATtiny12) Power Down(5), VCC = 3V, WDT enabled Power Down(5), VCC = 3V. WDT disabled (ATtiny12) Power Down(5), VCC = 3V. WDT disabled (ATTINY11) VACIO IACLK TACPD Notes: Analog Comparator Input Offset Voltage Analog Comparator Input Leakage Current Analog Comparator Propagation Delay VCC = 5V VIN = VCC/2 VCC = 5V VIN = VCC/2 VCC = 2.7V VCC = 4.0V -50 750 500 9.0 <1 <1 Min Typ Max 1.0 2.0 2.5 10 10 0.4 0.5 1.0 2.0 3.5 15 2 5 40 50 Units mA mA mA mA mA mA mA mA mA mA A A A mV nA ns
1. "Max" means the highest value where the pin is guaranteed to be read as low. 2. "Min" means the lowest value where the pin is guaranteed to be read as high. 3. Although each I/O port can sink more than the test conditions (20 mA at VCC = 5V, 10 mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: 1] The sum of all IOL, for all ports, should not exceed 100 mA. If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test conditions. 4. Although each I/O port can source more than the test conditions (3 mA at VCC = 5V, 1.5 mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: 1] The sum of all IOH , for all ports, should not exceed 100 mA. If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition. 5. Minimum VCC for Power-down is 1.5V. (On ATtiny12: only with BOD disabled)
58
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
External Clock Drive Waveforms
Figure 33. External Clock
VIH1 VIL1
External Clock Drive ATTINY11
VCC = 2.7V to 4.0V Symbol 1/tCLCL tCLCL tCHCX tCLCX tCLCH tCHCL Parameter Oscillator Frequency Clock Period High Time Low Time Rise Time Fall Time Min 0 500 200 200 1.6 1.6 Max 2 VCC = 4.0V to 5.5V Min 0 167 67 67 0.5 0.5 Max 6 Units MHz ns ns ns s s
External Clock Drive ATtiny12
VCC = 1.8V to 2.7V Symbol 1/tCLCL tCLCL tCHCX tCLCX tCLCH tCHCL Parameter Oscillator Frequency Clock Period High Time Low Time Rise Time Fall Time Min 0 833 333 333 1.6 1.6 Max 1.2 VCC = 2.7V to 4.0V Min 0 250 100 100 1.6 1.6 Max 4 VCC = 4.0V to 5.5V Min 0 125 50 50 0.5 0.5 Max 8 Units MHz ns ns ns s s
Table 29. External RC Oscillator, Typical Frequencies
R [k] 100 31.5 6.5 Note: C [pF] 70 20 20 f 100 kHz 1.0 MHz 4.0 MHz
R should be in the range 3-100 k, and C should be at least 20 pF. The C values given in the table includes pin capacitance. This will vary with package type.
59
1006D-AVR-07/03
ATTINY11 Typical Characteristics
The following charts show typical behavior. These figures are not tested during manufacturing. All current consumption measurements are performed with all I/O pins configured as inputs and with internal pull-ups enabled. A sine wave generator with railto-rail output is used as clock source. The power consumption in Power-down Mode is independent of clock selection. The current consumption is a function of several factors such as: operating voltage, operating frequency, loading of I/O pins, switching rate of I/O pins, code executed and ambient temperature. The dominating factors are operating voltage and frequency. The current drawn from capacitive loaded pins may be estimated (for one pin) as CL*VCC*f where CL = load capacitance, VCC = operating voltage and f = average switching frequency of I/O pin. The parts are characterized at frequencies higher than test limits. Parts are not guaranteed to function properly at frequencies higher than the ordering code indicates. The difference between current consumption in Power-down Mode with Watchdog Timer enabled and Power-down Mode with Watchdog Timer disabled represents the differential current drawn by the Watchdog timer. Figure 34. Active Supply Current vs. Frequency
ACTIVE SUPPLY CURRENT vs. FREQUENCY
TA = 25C 18 16 14 VCC = 5V 12 VCC = 4.5V
ICC (mA)
VCC = 6V VCC = 5.5V
10 8 6 4 2 0 VCC = 2.1V VCC = 1.8V 0 1 2 3 VCC = 2.4V 4 5 6 7 8 9 10 11 12 13 14 15 VCC = 2.7V VCC = 3.3V VCC = 3.0V VCC = 4V VCC = 3.6V
Frequency (MHz)
60
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 35. Active Supply Current vs. VCC
ACTIVE SUPPLY CURRENT vs. Vcc
FREQUENCY = 4 MHz 10 9 8
TA = 25C
7
TA = 85C
6
ICC (mA)
5 4 3 2 1 0 2 2.5 3 3.5 4
VCC (V)
4.5
5
5.5
6
Figure 36. Active Supply Current vs. VCC, Device Clocked by Internal Oscillator
ACTIVE SUPPLY CURRENT vs. Vcc DEVICE CLOCKED BY 1.0MHz INTERNAL RC OSCILLATOR
6
5
TA = 25C
4
TA = 85C I cc(mA)
3
2
1
0
2.5 3 3.5 4
Vcc(V)
4.5
5
5.5
6
61
1006D-AVR-07/03
Figure 37. Active Supply Current vs. VCC, Device Clocked by External 32kHz Crystal
ACTIVE SUPPLY CURRENT vs. Vcc
DEVICE CLOCKED BY 32KHz CRYSTAL
5 4.5 4 3.5 3
TA = 25C TA = 85C
I cc(mA)
2.5 2 1.5 1 0.5 0
2.5
3
3.5
4
Vcc(V)
4.5
5
5.5
6
Figure 38. Idle Supply Current vs. Frequency
IDLE SUPPLY CURRENT vs. FREQUENCY
TA = 25C 5 VCC = 6V 4.5 4 3.5 3
ICC (mA)
VCC = 5.5V VCC = 5V VCC = 4.5V VCC = 4V VCC = 3.6V VCC = 3.3V VCC = 3.0V VCC = 2.7V VCC = 2.4V VCC = 2.1V VCC = 1.8V 1 2 3 4 5 6
2.5 2 1.5 1 0.5 0 0
7
8
9
10
11
12
13
14
15
Frequency (MHz)
62
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 39. Idle Supply Current vs. VCC
IDLE SUPPLY CURRENT vs. Vcc
FREQUENCY = 4 MHz 3
TA = 25C
2
TA = 85C ICC (mA)
2
1
1
0 2 2.5 3 3.5 4 VCC (V) 4.5 5 5.5 6
Figure 40. Idle Supply Current vs. VCC, Device Clocked by Internal Oscillator
IDLE SUPPLY CURRENT vs. Vcc DEVICE CLOCKED BY 1.0MHz INTERNAL RC OSCILLATOR
0.35 0.3 0.25 0.2
I cc(mA) TA = 25C TA = 85C
0.15 0.1 0.05 0 2.5 3 3.5 4
Vcc(V)
4.5
5
5.5
6
63
1006D-AVR-07/03
Figure 41. Idle Supply Current vs. VCC, Device Clocked by External 32kHz Crystal
IDLE SUPPLY CURRENT vs. Vcc DEVICE CLOCKED BY 32KHz CRYSTAL
25
20
TA = 25C TA = 85C
15
I cc(A)
10
5
0
2.5
3
3.5
4
Vcc(V)
4.5
5
5.5
6
Figure 42. Power-down Supply Current vs. VCC
POWER-DOWN SUPPLY CURRENT vs. Vcc
WATCHDOG TIMER DISABLED 9 8 7
ICC (A) TA = 85C
6 5 4 3 2 1 0 1.5 2 2.5 3 3.5 VCC (V) 4 4.5 5 5.5 6
TA = 25C
64
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 43. Power-down Supply Current vs. VCC
POWER-DOWN SUPPLY CURRENT vs. Vcc
WATCHDOG TIMER ENABLED 90 80 70 60
I CC (A) TA = 85C TA = 25C
50 40 30 20 10 0 1.5 2 2.5 3 3.5 VCC (V) 4 4.5 5 5.5 6
Figure 44. Analog Comparator Current vs. VCC
ANALOG COMPARATOR CURRENT vs. Vcc
1 0.9 0.8 0.7
I CC (mA) TA = 25C TA = 85C
0.6 0.5 0.4 0.3 0.2 0.1 0 1.5 2 2.5 3 3.5 VCC (V) 4 4.5 5
5.5
6
65
1006D-AVR-07/03
Analog comparator offset voltage is measured as absolute offset. Figure 45. Analog Comparator Offset Voltage vs. Common Mode Voltage
ANALOG COMPARATOR OFFSET VOLTAGE vs. COMMON MODE VOLTAGE Vcc = 5V
18 16 14 Offset Voltage (mV) 12 10 8 6 4 2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
TA = 25C
TA = 85C
Common Mode Voltage (V)
Figure 46. Analog Comparator Offset Voltage vs. Common Mode Voltage
ANALOG COMPARATOR OFFSET VOLTAGE vs. Vcc = 2.7V COMMON MODE VOLTAGE
10
TA = 25C
8 Offset Voltage (mV)
6
TA = 85C
4
2
0 0 0.5 1 1.5 Common Mode Voltage (V) 2 2.5 3
66
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 47. Analog Comparator Input Leakage Current
ANALOG COMPARATOR INPUT LEAKAGE CURRENT
VCC = 6V TA = 25C
60 50 40
IACLK (nA)
30 20 10 0 -10 0 0.5 1 1.5 2 2.5 3 3.5
VIN (V)
4
4.5
5
5.5
6
6.5
7
Figure 48. Watchdog Oscillator Frequency vs. VCC
WATCHDOG OSCILLATOR FREQUENCY vs. Vcc
1600 1400 1200
TA = 85C
TA = 25C
1000
FRC (kHz)
800 600 400 200 0 1.5 2 2.5 3 3.5
VCC (V)
4
4.5
5
5.5
6
67
1006D-AVR-07/03
Sink and source capabilities of I/O ports are measured on one pin at a time. Figure 49. Pull-up Resistor Current vs. Input Voltage
PULL-UP RESISTOR CURRENT vs. INPUT VOLTAGE
VCC = 5V 120
TA = 25C
100
TA = 85C
80 I OP (A)
60
40
20
0 0 0.5 1 1.5 2 2.5 VOP (V) 3 3.5 4 4.5 5
Figure 50. Pull-up Resistor Current vs. Input Voltage
PULL-UP RESISTOR CURRENT vs. INPUT VOLTAGE
VCC = 2.7V 30
TA = 25C
25
TA = 85C
20 I OP (A)
15
10
5
0 0 0.5 1 1.5 VOP (V) 2 2.5 3
68
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 51. I/O Pin Sink Current vs. Output Voltage
I/O PIN SINK CURRENT vs. OUTPUT VOLTAGE
VCC = 5V 80 70 60 50 I OL (mA) 40 30 20 10 0 0 0.5 1 1.5 VOL (V) 2 2.5 3
TA = 85C TA = 25C
Figure 52. I/O Pin Source Current vs. Output Voltage
I/O PIN SOURCE CURRENT vs. OUTPUT VOLTAGE
VCC = 5V
18 16 14 12
TA = 25C
TA = 85C
I OH (mA)
10 8 6 4 2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
VOH (V)
69
1006D-AVR-07/03
Figure 53. I/O Pin Sink Current vs. Output Voltage
I/O PIN SINK CURRENT vs. OUTPUT VOLTAGE
VCC = 2.7V 30
TA = 25C
25
20
TA = 85C
I OL (mA)
15
10
5
0 0 0.5 1 VOL (V) 1.5 2
Figure 54. I/O Pin Source Current vs. Output Voltage
I/O PIN SOURCE CURRENT vs. OUTPUT VOLTAGE
VCC = 2.7V 6
TA = 25C
5
4
TA = 85C
I OH (mA)
3
2
1
0 0 0.5 1 1.5 VOH (V) 2 2.5 3
70
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 55. I/O Pin Input Threshold Voltage vs. VCC
I/O PIN INPUT THRESHOLD VOLTAGE vs. Vcc
TA = 25C
2.5
2
Threshold Voltage (V)
1.5
1
0.5
0 2.7 4.0 VCC 5.0
Figure 56. I/O Pin Input Hysteresis vs. VCC
I/O PIN INPUT HYSTERESIS vs. Vcc
TA = 25C
0.18 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 2.7 4.0 VCC 5.0
Input Hysteresis (V)
71
1006D-AVR-07/03
ATtiny12 Typical Characteristics
The following charts show typical behavior. These data are characterized, but not tested. All current consumption measurements are performed with all I/O pins configured as inputs and with internal pull-ups enabled. A sine wave generator with rail-to-rail output is used as clock source. The power consumption in Power-down Mode is independent of clock selection. The current consumption is a function of several factors such as: operating voltage, operating frequency, loading of I/O pins, switching rate of I/O pins, code executed and ambient temperature. The dominating factors are operating voltage and frequency. The current drawn from capacitive loaded pins may be estimated (for one pin) as CL*VCC*f where CL = load capacitance, VCC = operating voltage and f = average switching frequency of I/O pin. The parts are characterized at frequencies higher than test limits. Parts are not guaranteed to function properly at frequencies higher than the ordering code indicates. The difference between current consumption in Power-down Mode with Watchdog Timer enabled and Power-down Mode with Watchdog Timer disabled represents the differential current drawn by the Watchdog timer. Figure 57. Active Supply Current vs. VCC, Device Clocked by Internal Oscillator
ACTIVE SUPPLY CURRENT vs. Vcc DEVICE CLOCKED BY 1.2MHz INTERNAL RC OSCILLATOR
1.8 1.6
TA = 85C
1.4 1.2
I cc(m) TA = 25C
1 0.8 0.6 0.4 0.2 0 1.5 2 2.5 3 3.5
Vcc(V)
4
4.5
5
5.5
6
72
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 58. Active Supply Current vs. VCC, Device Clocked by External 32kHz Crystal
ACTIVE SUPPLY CURRENT vs. Vcc
DEVICE CLOCKED BY 32KHz CRYSTAL
140 120
TA = 85C
100
TA = 25C I cc()
80 60 40 20 0
1.5
2
2.5
3
3.5
Vcc(V)
4
4.5
5
5.5
6
Figure 59. Idle Supply Current vs. VCC, Device Clocked by Internal Oscillator
IDLE SUPPLY CURRENT vs. Vcc DEVICE CLOCKED BY 1.2MHz INTERNAL RC OSCILLATOR
0.8 0.7 0.6 0.5
I cc(m) TA = 25C TA = 85C
0.4 0.3 0.2 0.1 0 1.5 2 2.5 3 3.5
Vcc(V)
4
4.5
5
5.5
6
73
1006D-AVR-07/03
Figure 60. Idle Supply Current vs. VCC, Device Clocked by External 32kHz Crystal
IDLE SUPPLY CURRENT vs. Vcc
30 DEVICE CLOCKED BY 32KHz CRYSTAL
25
20
I cc()
15
10
TA = 85C TA = 25C
5
0 1.5 2 2.5 3 3.5
Vcc(V)
4
4.5
5
5.5
6
Analog Comparator offset voltage is measured as absolute offset. Figure 61. Analog Comparator Offset Voltage vs. Common Mode Voltage
ANALOG COMPARATOR OFFSET VOLTAGE vs. COMMON MODE VOLTAGE VCC = 5V
18 16 14 Offset Voltage (mV) 12 10 8 6 4 2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
TA = 25C
TA = 85C
Common Mode Voltage (V)
74
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 62. Analog Comparator Offset Voltage vs. Common Mode Voltage
ANALOG COMPARATOR OFFSET VOLTAGE vs. COMMON MODE VOLTAGE VCC = 2.7V
10
TA = 25C
8 Offset Voltage (mV)
6
TA = 85C
4
2
0 0 0.5 1 1.5 Common Mode Voltage (V) 2 2.5 3
Figure 63. Analog Comparator Input Leakage Current
ANALOG COMPARATOR INPUT LEAKAGE CURRENT
VCC = 6V TA = 25C
60 50 40
I ACLK (nA)
30 20 10 0 -10 0 0.5 1 1.5 2 2.5 3 3.5
VIN (V)
4
4.5
5
5.5
6
6.5
7
75
1006D-AVR-07/03
Figure 64. Calibrated RC Oscillator Frequency vs. VCC
CALIBRATED RC OSCILLATOR FREQUENCY vs. OPERATING VOLTAGE
1.22 1.2 1.18 1.16 FRC(MHz) 1.14 1.12 1.1 1.08 1.06 2 2.5 3 3.5 4
VCC(V) TA = 85C TA = 25C TA = 45C TA = 70C
4.5
5
5.5
6
Figure 65. Watchdog Oscillator Frequency vs. VCC
WATCHDOG OSCILLATOR FREQUENCY vs. Vcc
1600 1400 1200
TA = 85C
TA = 25C
1000
FRC (kHz)
800 600 400 200 0 1.5 2 2.5 3 3.5
VCC (V)
4
4.5
5
5.5
6
76
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Sink and source capabilities of I/O ports are measured on one pin at a time. Figure 66. Pull-up Resistor Current vs. Input Voltage (VCC = 5V)
120
TA = 25C
100
TA = 85C
80 I OP (A)
60
40
20
0 0 0.5 1 1.5 2 2.5 VOP (V) 3 3.5 4 4.5 5
Figure 67. Pull-up Resistor Current vs. Input Voltage (VCC = 2.7V)
30
TA = 25C
25
TA = 85C
20 IOP (A)
15
10
5
0 0 0.5 1 1.5 VOP (V) 2 2.5 3
77
1006D-AVR-07/03
Figure 68. I/O Pin Sink Current vs. Output Voltage (VCC = 5V)
70
TA = 25C
60
TA = 85C
50 40 I OL (mA) 30 20 10 0 0 0.5 1 1.5 VOL (V) 2 2.5 3
Figure 69. I/O Pin Source Current vs. Output Voltage (VCC = 5V)
20 18 16 14 12 I OH (mA) 10 8 6 4 2 0 0 0.5 1
TA = 25C
TA = 85C
1.5
2
2.5 VOH (V)
3
3.5
4
4.5
5
78
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Figure 70. I/O Pin Sink Current vs. Output Voltage (VCC = 2.7V)
25
TA = 25C
20
TA = 85C
15 I OL (mA)
10
5
0 0 0.5 1 VOL (V) 1.5 2
Figure 71. I/O Pin Source Current vs. Output Voltage (VCC = 2.7V)
6
TA = 25C
5
TA = 85C
4 I OH (mA)
3
2
1
0 0 0.5 1 1.5 VOH (V) 2 2.5 3
79
1006D-AVR-07/03
Figure 72. I/O Pin Input Threshold Voltage vs. VCC (TA = 25C)
2.5
2
Threshold Voltage (V)
1.5
1
0.5
0 2.7 4.0 VCC 5.0
Figure 73. I/O Pin Input Hysteresis vs. VCC (TA = 25C)
0.18 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 2.7 4.0 VCC 5.0
80
ATTINY11/12
1006D-AVR-07/03
Input Hysteresis (V)
ATTINY11/12
Register Summary ATTINY11
Address
$3F $3E $3D $3C $3B $3A $39 $38 $37 $36 $35 $34 $33 $32 $31 $30 ... $22 $21 $20 $1F $1E $1D $1C $1B $1A $19 $18 $17 $16 $15 ... $0A $09 $08 ... $00
Name
SREG Reserved Reserved Reserved GIMSK GIFR TIMSK TIFR Reserved Reserved MCUCR MCUSR TCCR0 TCNT0 Reserved Reserved Reserved Reserved WDTCR Reserved Reserved Reserved Reserved Reserved Reserved Reserved Reserved PORTB DDRB PINB Reserved Reserved Reserved Reserved ACSR Reserved Reserved
Bit 7
I
Bit 6
T
Bit 5
H
Bit 4
S
Bit 3
V
Bit 2
N
Bit 1
Z
Bit 0
C
Page
page 14
-
INT0 INTF0 -
PCIE PCIF -
-
-
-
TOIE0 TOV0
-
page 25 page 26 page 26 page 27
-
-
SE -
SM -
-
CS02
ISC01 EXTRF CS01
ISC00 PORF CS00
page 29 page 23 page 34 page 35
Timer/Counter0 (8 Bit)
-
-
-
WDTOE
WDE
WDP2
WDP1
WDP0
page 36
-
-
PINB5
PORTB4 DDB4 PINB4
PORTB3 DDB3 PINB3
PORTB2 DDB2 PINB2
PORTB1 DDB1 PINB1
PORTB0 DDB0 PINB0
page 44 page 44 page 44
ACD
-
ACO
ACI
ACIE
-
ACIS1
ACIS0
page 41
Notes:
1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses should never be written. 2. Some of the status flags are cleared by writing a logical one to them. Note that the CBI and SBI instructions will operate on all bits in the I/O register, writing a one back into any flag read as set, thus clearing the flag. The CBI and SBI instructions work with registers $00 to $1F only.
81
1006D-AVR-07/03
Register Summary ATtiny12
Address
$3F $3E $3D $3C $3B $3A $39 $38 $37 $36 $35 $34 $33 $32 $31 $30 ... $22 $21 $20 $1F $1E $1D $1C $1B $1A $19 $18 $17 $16 $15 ... $0A $09 $08 ... $00
Name
SREG Reserved Reserved Reserved GIMSK GIFR TIMSK TIFR Reserved Reserved MCUCR MCUSR TCCR0 TCNT0 OSCCAL Reserved Reserved Reserved WDTCR Reserved Reserved EEAR EEDR EECR Reserved Reserved Reserved PORTB DDRB PINB Reserved Reserved Reserved Reserved ACSR Reserved Reserved
Bit 7
I
Bit 6
T
Bit 5
H
Bit 4
S
Bit 3
V
Bit 2
N
Bit 1
Z
Bit 0
C
Page
page 14
-
INT0 INTF0 -
PCIE PCIF -
-
-
-
TOIE0 TOV0
-
page 25 page 26 page 26 page 27
-
PUD -
SE -
SM -
WDRF -
BORF CS02
ISC01 EXTRF CS01
ISC00 PORF CS00
page 29 page 24 page 34 page 35 page 32
Timer/Counter0 (8 Bit) Oscillator Calibration Register
-
-
-
WDTOE
WDE
WDP2
WDP1
WDP0
page 36
-
-
EEPROM Address Register EERIE EEMWE EEWE EERE
page 38 page 38 page 38
EEPROM Data Register
-
-
DDB5 PINB5
PORTB4 DDB4 PINB4
PORTB3 DDB3 PINB3
PORTB2 DDB2 PINB2
PORTB1 DDB1 PINB1
PORTB0 DDB0 PINB0
page 44 page 44 page 44
ACD
AINBG
ACO
ACI
ACIE
-
ACIS1
ACIS0
page 41
Note:
1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses should never be written. 2. Some of the status flags are cleared by writing a logical one to them. Note that the CBI and SBI instructions will operate on all bits in the I/O register, writing a one back into any flag read as set, thus clearing the flag. The CBI and SBI instructions work with registers $00 to $1F only.
82
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Instruction Set Summary
Mnemonics
ADD ADC SUB SUBI SBC SBCI AND ANDI OR ORI EOR COM NEG SBR CBR INC DEC TST CLR SER RJMP RCALL RET RETI CPSE CP CPC CPI SBRC SBRS SBIC SBIS BRBS BRBC BREQ BRNE BRCS BRCC BRSH BRLO BRMI BRPL BRGE BRLT BRHS BRHC BRTS BRTC BRVS BRVC BRIE BRID Rd,Rr Rd,Rr Rd,Rr Rd,K Rr, b Rr, b P, b P, b s, k s, k k k k k k k k k k k k k k k k k k k
Operands
Rd, Rr Rd, Rr Rd, Rr Rd, K Rd, Rr Rd, K Rd, Rr Rd, K Rd, Rr Rd, K Rd, Rr Rd Rd Rd,K Rd,K Rd Rd Rd Rd Rd k k
Description
Add two Registers Add with Carry two Registers Subtract two Registers Subtract Constant from Register Subtract with Carry two Registers Subtract with Carry Constant from Reg. Logical AND Registers Logical AND Register and Constant Logical OR Registers Logical OR Register and Constant Exclusive OR Registers One's Complement Two's Complement Set Bit(s) in Register Clear Bit(s) in Register Increment Decrement Test for Zero or Minus Clear Register Set Register Relative Jump Relative Subroutine Call Subroutine Return Interrupt Return Compare, Skip if Equal Compare Compare with Carry Compare Register with Immediate Skip if Bit in Register Cleared Skip if Bit in Register is Set Skip if Bit in I/O Register Cleared Skip if Bit in I/O Register is Set Branch if Status Flag Set Branch if Status Flag Cleared Branch if Equal Branch if Not Equal Branch if Carry Set Branch if Carry Cleared Branch if Same or Higher Branch if Lower Branch if Minus Branch if Plus Branch if Greater or Equal, Signed Branch if Less Than Zero, Signed Branch if Half Carry Flag Set Branch if Half Carry Flag Cleared Branch if T Flag Set Branch if T Flag Cleared Branch if Overflow Flag is Set Branch if Overflow Flag is Cleared Branch if Interrupt Enabled Branch if Interrupt Disabled
Operation
Rd Rd + Rr Rd Rd + Rr + C Rd Rd - Rr Rd Rd - K Rd Rd - Rr - C Rd Rd - K - C Rd Rd * Rr Rd Rd * K Rd Rd v Rr Rd Rd v K Rd RdRr Rd $FF - Rd Rd $00 - Rd Rd Rd v K Rd Rd * (FFh - K) Rd Rd + 1 Rd Rd - 1 Rd Rd * Rd Rd RdRd Rd $FF PC PC + k + 1 PC PC + k + 1 PC STACK PC STACK if (Rd = Rr) PC PC + 2 or 3 Rd - Rr Rd - Rr - C Rd - K if (Rr(b)=0) PC PC + 2 or 3 if (Rr(b)=1) PC PC + 2 or 3 if (P(b)=0) PC PC + 2 or 3 if (P(b)=1) PC PC + 2 or 3 if (SREG(s) = 1) then PCPC + k + 1 if (SREG(s) = 0) then PCPC + k + 1 if (Z = 1) then PC PC + k + 1 if (Z = 0) then PC PC + k + 1 if (C = 1) then PC PC + k + 1 if (C = 0) then PC PC + k + 1 if (C = 0) then PC PC + k + 1 if (C = 1) then PC PC + k + 1 if (N = 1) then PC PC + k + 1 if (N = 0) then PC PC + k + 1 if (N V= 0) then PC PC + k + 1 if (N V= 1) then PC PC + k + 1 if (H = 1) then PC PC + k + 1 if (H = 0) then PC PC + k + 1 if (T = 1) then PC PC + k + 1 if (T = 0) then PC PC + k + 1 if (V = 1) then PC PC + k + 1 if (V = 0) then PC PC + k + 1 if ( I = 1) then PC PC + k + 1 if ( I = 0) then PC PC + k + 1
Flags
Z,C,N,V,H Z,C,N,V,H Z,C,N,V,H Z,C,N,V,H Z,C,N,V,H Z,C,N,V,H Z,N,V Z,N,V Z,N,V Z,N,V Z,N,V Z,C,N,V Z,C,N,V,H Z,N,V Z,N,V Z,N,V Z,N,V Z,N,V Z,N,V None None None None I None Z, N,V,C,H Z, N,V,C,H Z, N,V,C,H None None None None None None None None None None None None None None None None None None None None None None None None
#Clocks
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 4 4 1/2 1 1 1 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2
ARITHMETIC AND LOGIC INSTRUCTIONS
BRANCH INSTRUCTIONS
83
1006D-AVR-07/03
Instruction Set Summary (Continued)
Mnemonics
LD ST MOV LDI IN OUT LPM BIT AND BIT-TEST INSTRUCTIONS SBI CBI LSL LSR ROL ROR ASR SWAP BSET BCLR BST BLD SEC CLC SEN CLN SEZ CLZ SEI CLI SES CLS SEV CLV SET CLT SEH CLH NOP SLEEP WDR P,b P,b Rd Rd Rd Rd Rd Rd s s Rr, b Rd, b Set Bit in I/O Register Clear Bit in I/O Register Logical Shift Left Logical Shift Right Rotate Left Through Carry Rotate Right Through Carry Arithmetic Shift Right Swap Nibbles Flag Set Flag Clear Bit Store from Register to T Bit load from T to Register Set Carry Clear Carry Set Negative Flag Clear Negative Flag Set Zero Flag Clear Zero Flag Global Interrupt Enable Global Interrupt Disable Set Signed Test Flag Clear Signed Test Flag Set Twos Complement Overflow Clear Twos Complement Overflow Set T in SREG Clear T in SREG Set Half Carry Flag in SREG Clear Half Carry Flag in SREG No Operation Sleep Watch Dog Reset (see specific descr. for Sleep function) (see specific descr. for WDR/timer) I/O(P,b) 1 I/O(P,b) 0 Rd(n+1) Rd(n), Rd(0) 0 Rd(n) Rd(n+1), Rd(7) 0 Rd(0) C, Rd(n+1) Rd(n), C Rd(7) Rd(7) C, Rd(n) Rd(n+1), C Rd(0) Rd(n) Rd(n+1), n = 0..6 Rd(3..0) Rd(7..4), Rd(7..4) Rd(3..0) SREG(s) 1 SREG(s) 0 T Rr(b) Rd(b) T C1 C0 N1 N0 Z1 Z0 I1 I0 S1 S0 V1 V0 T1 T0 H1 H0 None None Z,C,N,V Z,C,N,V Z,C,N,V Z,C,N,V Z,C,N,V None SREG(s) SREG(s) T None C C N N Z Z I I S S V V T T H H None None None 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Operands
Rd,Z Z,Rr Rd, Rr Rd, K Rd, P P, Rr
Description
Load Register Indirect Store Register Indirect Move Between Registers Load Immediate In Port Out Port Load Program Memory
Operation
Rd (Z) (Z) Rr Rd Rr Rd K Rd P P Rr R0 (Z)
Flags
None None None None None None None
#Clocks
2 2 1 1 1 1 3
DATA TRANSFER INSTRUCTIONS
84
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Ordering Information
Power Supply 2.7 - 5.5V Speed (MHz) 2 Ordering Code ATTINY11L-2PC ATTINY11L-2SC ATTINY11L-2PI ATTINY11L-2SI 4.0 - 5.5V 6 ATTINY11-6PC ATTINY11-6SC ATTINY11-6PI ATTINY11-6SI 1.8 - 5.5V 1.2 ATtiny12V-1PC ATtiny12V-1SC ATtiny12V-1PI ATtiny12V-1SI 2.7 - 5.5V 4 ATtiny12L-4PC ATtiny12L-4SC ATtiny12L-4PI ATtiny12L-4SI 4.0 - 5.5V 8 ATtiny12-8PC ATtiny12-8SC ATtiny12-8PI ATtiny12-8SI Note: Package 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 8P3 8S2 Operation Range Commercial (0C to 70C) Industrial (-40C to 85C) Commercial (0C to 70C) Industrial (-40C to 85C) Commercial (0C to 70C) Industrial (-40C to 85C) Commercial (0C to 70C) Industrial (-40C to 85C) Commercial (0C to 70C) Industrial (-40C to 85C)
The speed grade refers to maximum clock rate when using an external crystal or external clock drive. The internal RC oscillator has the same nominal clock frequency for all speed grades.
Package Type 8P3 8S2 8-lead, 0.300" Wide, Plastic Dual Inline Package (PDIP) 8-lead, 0.200" Wide, Plastic Gull-Wing Small Outline (EIAJ SOIC)
85
1006D-AVR-07/03
Packaging Information
8P3
1
E E1
N
Top View
c eA
End View
D e D1 A2 A
SYMBOL
COMMON DIMENSIONS (Unit of Measure = inches) MIN NOM MAX NOTE
A A2 b b2 b3 c D 0.115 0.014 0.045 0.030 0.008 0.355 0.005 0.300 0.240 0.310 0.250 0.100 BSC 0.300 BSC 0.115 0.130 0.130 0.018 0.060 0.039 0.010 0.365
0.210 0.195 0.022 0.070 0.045 0.014 0.400
2
5 6 6
3 3
b2 b3
4 PLCS
L
D1 E E1 e eA L
b
0.325 0.280
4 3
Side View
4 0.150 2
Notes:
1. This drawing is for general information only; refer to JEDEC Drawing MS-001, Variation BA for additional information. 2. Dimensions A and L are measured with the package seated in JEDEC seating plane Gauge GS-3. 3. D, D1 and E1 dimensions do not include mold Flash or protrusions. Mold Flash or protrusions shall not exceed 0.010 inch. 4. E and eA measured with the leads constrained to be perpendicular to datum. 5. Pointed or rounded lead tips are preferred to ease insertion. 6. b2 and b3 maximum dimensions do not include Dambar protrusions. Dambar protrusions shall not exceed 0.010 (0.25 mm).
01/09/02 2325 Orchard Parkway San Jose, CA 95131 TITLE 8P3, 8-lead, 0.300" Wide Body, Plastic Dual In-line Package (PDIP) DRAWING NO. 8P3 REV. B
R
86
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
8S2
1
H
N
Top View
e
b
A
D
Side View
SYMBOL
COMMON DIMENSIONS (Unit of Measure = mm) MIN NOM MAX NOTE
A
1.78 0.05 0.35 0.18 5.13 5.13 7.62 0.51 1.27 BSC
2.03 0.33 0.51 0.25 5.38 5.41 8.38 0.89 4 2, 3 5 5
A1 L E
C
A1 b C D E
End View
H L e
Notes: 1. 2. 3. 4. 5.
This drawing is for general information only; refer to EIAJ Drawing EDR-7320 for additional information. Mismatch of the upper and lower dies and resin burrs aren't included. It is recommended that upper and lower cavities be equal. If they are different, the larger dimension shall be regarded. Determines the true geometric position. Values b,C apply to pb/Sn solder plated terminal. The standard thickness of the solder layer shall be 0.010 +0.010/-0.005 mm.
5/2/02 TITLE 8S2, 8-lead, 0.209" Body, Plastic Small Outline Package (EIAJ) DRAWING NO. REV. B
R
2325 Orchard Parkway San Jose, CA 95131
8S2
87
1006D-AVR-07/03
Data Sheet Change Log for ATTINY11/12
Changes from Rev. 1006C-09/01 to Rev. 1006D-07/03
Please note that the referring page numbers in this section are referred to this document. The referring revision in this section are referring to the document revision. 1. Updated VBOT values in Table 8 on page 19.
88
ATTINY11/12
1006D-AVR-07/03
ATTINY11/12
Table of Contents
Features................................................................................................. 1 Pin Configuration.................................................................................. 1 Description ............................................................................................ 2
ATTINY11 Block Diagram ....................................................................................... ATtiny12 Block Diagram ....................................................................................... Pin Descriptions.................................................................................................... Clock Options ....................................................................................................... 2 4 5 5
Architectural Overview......................................................................... 8
General-purpose Register File.............................................................................. 9 ALU - Arithmetic Logic Unit................................................................................ 10 Flash Program Memory ...................................................................................... 10 Program and Data Addressing Modes................................................................ 10 Subroutine and Interrupt Hardware Stack .......................................................... 12 EEPROM Data Memory...................................................................................... 13 Memory Access and Instruction Execution Timing ............................................. 13 I/O Memory ......................................................................................................... 14 Reset and Interrupt Handling.............................................................................. 15 ATtiny12 Internal Voltage Reference.................................................................. 24 Interrupt Handling ............................................................................................... 25 Sleep Modes for the ATTINY11 ............................................................................ 31 Sleep Modes for the ATtiny12 ............................................................................ 31 ATtiny12 Calibrated Internal RC Oscillator ......................................................... 32
Timer/Counter0 ................................................................................... 33
Timer/Counter Prescaler..................................................................................... 33
Watchdog Timer.................................................................................. 36 ATtiny12 EEPROM Read/Write Access............................................. 38
Prevent EEPROM Corruption ............................................................................. 40
Analog Comparator ............................................................................ 41 I/O Port B ............................................................................................. 43 Memory Programming........................................................................ 46
Program (and Data) Memory Lock Bits .............................................................. Fuse Bits in ATTINY11.......................................................................................... Fuse Bits in ATtiny12.......................................................................................... Signature Bytes .................................................................................................. Calibration Byte in ATtiny12 ............................................................................... Programming the Flash and EEPROM............................................................... High-voltage Serial Programming....................................................................... 46 46 46 47 47 47 48
i
1006D-AVR-07/03
High-voltage Serial Programming Algorithm....................................................... High-voltage Serial Programming Characteristics .............................................. Low-voltage Serial Downloading (ATtiny12 only) ............................................... Low-voltage Serial Programming Characteristics ...............................................
49 52 52 56
Electrical Characteristics................................................................... 57
Absolute Maximum Ratings ................................................................................ DC Characteristics - Preliminary Data ............................................................... External Clock Drive Waveforms ........................................................................ External Clock Drive ATTINY11 ............................................................................ External Clock Drive ATtiny12 ............................................................................ ATTINY11 Typical Characteristics ........................................................................ ATtiny12 Typical Characteristics ........................................................................ 57 57 59 59 59 60 72
Register Summary ATTINY11 .............................................................. 81 Register Summary ATtiny12 .............................................................. 82 Instruction Set Summary ................................................................... 83 Ordering Information .......................................................................... 85 Packaging Information ....................................................................... 86
8P3 ..................................................................................................................... 86 8S2 ..................................................................................................................... 87
Data Sheet Change Log for Chip Number ........................................ 88
Changes from Rev. 1006C-09/01 to Rev. 1006D-07/03..................................... 88
Table of Contents .................................................................................. i
ii
ATTINY11/12
1006D-AVR-07/03
Atmel Corporation
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 487-2600
Atmel Operations
Memory
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 436-4314
RF/Automotive
Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 Tel: 1(719) 576-3300 Fax: 1(719) 540-1759
Regional Headquarters
Europe
Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500
Microcontrollers
2325 Orchard Parkway San Jose, CA 95131 Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60
Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom
Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80
Asia
Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369
ASIC/ASSP/Smart Cards
Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906 Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743
Japan
9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581
e-mail
literature@atmel.com
Web Site
http://www.atmel.com
Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company's standard warranty which is detailed in Atmel's Terms and Conditions located on the Company's web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel's products are not authorized for use as critical components in life support devices or systems.
(c) Atmel Corporation 2003. All rights reserved. Atmel(R) and combinations thereof, AVR (R) and AVR Studio (R) are the registered trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be the trademarks of others. Printed on recycled paper.
1006D-AVR-07/03 0M


▲Up To Search▲   

 
Price & Availability of ATTINY11

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X